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:
Karl Tauber
2021-09-28 19:34:53 +02:00
parent 06b3de720a
commit 82df2ecfa9
4 changed files with 21 additions and 2 deletions

View File

@@ -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