void () { super.configureEditor(); installEditorKeyListener(comboBox.getEditor()); if (editor instanceof JComponent jEditor) { jEditor.setOpaque(false); jEditor.setBorder(JBUI.Borders.empty()); editorFocusListener = new FocusAdapter() { @Override public void focusGained(FocusEvent e) { update(); } @Override public void focusLost(FocusEvent e) { update(); } private void update() { if (comboBox != null) { comboBox.repaint(); } } }; if (editor instanceof JTextComponent) { editor.addFocusListener(editorFocusListener); } else { EditorTextField etf = UIUtil.findComponentOfType((JComponent)editor, EditorTextField.class); if (etf != null) { etf.addFocusListener(editorFocusListener); Color c = UIManager.getColor(comboBox.isEnabled() ? "TextField.background" : "ComboBox.disabledBackground"); etf.setBackground(c); } } } // BasicComboboxUI sets focusability depending on the combobox focusability. // JPanel usually is unfocusable and uneditable. // It could be set as an editor when people want to have a composite component as an editor. // In such cases we should restore unfocusable state for panels. if (editor instanceof JPanel) { editor.setFocusable(false); } }