diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatComboBoxUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatComboBoxUI.java index 1d438c7e..c69365a1 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatComboBoxUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatComboBoxUI.java @@ -670,6 +670,9 @@ public class FlatComboBoxUI /** @since 1.3 */ public static boolean isPermanentFocusOwner( JComboBox comboBox ) { if( comboBox.isEditable() ) { + if( FlatUIUtils.isPermanentFocusOwner( comboBox ) ) + return true; + Component editorComponent = comboBox.getEditor().getEditorComponent(); return (editorComponent != null) ? FlatUIUtils.isPermanentFocusOwner( editorComponent ) : false; } else diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeEditorPane.java b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeEditorPane.java index a4b3d4da..e6ee4133 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeEditorPane.java +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeEditorPane.java @@ -166,6 +166,11 @@ class FlatThemeEditorPane scrollPane.getGutter().setLineNumberFont( font ); } + void windowActivated() { + if( preview != null ) + preview.repaint(); + } + @Override public boolean requestFocusInWindow() { return textArea.requestFocusInWindow(); diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeFileEditor.java b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeFileEditor.java index 1a49c9dc..69a23921 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeFileEditor.java +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeFileEditor.java @@ -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 ); diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewAll.java b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewAll.java index b9dac102..30eece47 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewAll.java +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewAll.java @@ -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 )