void (Mode mode) { // mySettingsPanel.setVisible(mode == Mode.ADVANCED); myForm.getEditContextButton().setVisible(mode == Mode.ADVANCED); if (mode == Mode.ADVANCED) { setEditor(myEditor, GridConstraints.SIZEPOLICY_WANT_GROW); myEditor.getField().selectAll(); } else { setEditor(myComboBox, GridConstraints.SIZEPOLICY_FIXED); myComboBox.setModel(myModel); myComboBox.getEditor().selectAll(); } SwingUtilities.invokeLater(() -> { final Editor editor = getEditor(); if (editor != null) { editor.getContentComponent().grabFocus(); } }); }