mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-10 22:17:13 -06:00
ComboBox: paint focus border if combobox component itself is focused (instead of internal text field) or if client property JComponent.focusOwner is set
Theme Editor: - do not set client property `JComponent.focusOwner` on internal components of combobox and spinner - repaint preview on window activation (necessary because if something changed in editor and switching to another app, the editor is saved and the preview is updated while the editor window is not-active, which hides all focus indicators)
This commit is contained in:
@@ -166,6 +166,11 @@ class FlatThemeEditorPane
|
||||
scrollPane.getGutter().setLineNumberFont( font );
|
||||
}
|
||||
|
||||
void windowActivated() {
|
||||
if( preview != null )
|
||||
preview.repaint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requestFocusInWindow() {
|
||||
return textArea.requestFocusInWindow();
|
||||
|
||||
@@ -148,6 +148,14 @@ class FlatThemeFileEditor
|
||||
restoreState();
|
||||
restoreWindowBounds();
|
||||
|
||||
addWindowListener( new WindowAdapter() {
|
||||
@Override
|
||||
public void windowActivated( WindowEvent e ) {
|
||||
for( FlatThemeEditorPane themeEditorPane : getThemeEditorPanes() )
|
||||
themeEditorPane.windowActivated();
|
||||
}
|
||||
} );
|
||||
|
||||
// load directory
|
||||
if( dir == null ) {
|
||||
String recentDirectory = state.get( KEY_RECENT_DIRECTORY, null );
|
||||
|
||||
@@ -188,8 +188,11 @@ class FlatThemePreviewAll
|
||||
if( !isControlComponent( comp ) && comp instanceof JComponent )
|
||||
((JComponent)comp).putClientProperty( FlatClientProperties.COMPONENT_FOCUS_OWNER, value );
|
||||
|
||||
if( !(comp instanceof Container) || comp instanceof JInternalFrame )
|
||||
return;
|
||||
if( !(comp instanceof Container) ||
|
||||
comp instanceof JComboBox ||
|
||||
comp instanceof JSpinner ||
|
||||
comp instanceof JInternalFrame )
|
||||
return;
|
||||
|
||||
for( Component c : ((Container)comp).getComponents() ) {
|
||||
if( c instanceof JScrollPane )
|
||||
|
||||
Reference in New Issue
Block a user