JPanel () { JPanel panel = new JPanel(); myLayout = new CardLayout(); panel.setLayout(myLayout); myDescriptionTextField = new JBTextField(); myDescriptionTextField.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { showDescription(getSelectedScheme()); } }); myDescriptionTextField.registerKeyboardAction(__ -> { showDescription(getSelectedScheme()); IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> IdeFocusManager.getGlobalInstance().requestFocus(getConfigurableFocusComponent(), true)); }, ESC_KEY_STROKE, JComponent.WHEN_FOCUSED); myDescriptionTextField.registerKeyboardAction(__ -> { applyDescription(); IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> IdeFocusManager.getGlobalInstance().requestFocus(getConfigurableFocusComponent(), true)); }, ENTER_KEY_STROKE, JComponent.WHEN_FOCUSED); myDescriptionLabel = new DescriptionLabel(); new ClickListener() { @Override public boolean onClick(@NotNull MouseEvent event, int clickCount) { if (clickCount != 2) { return false; } editDescription(myDescriptionLabel.getText()); return true; } }.installOn(myDescriptionLabel); myWarningLabel = new JLabel(); panel.add(myDescriptionTextField, EDIT_DESCRIPTION_CARD); panel.add(myDescriptionLabel, SHOW_DESCRIPTION_CARD); panel.add(myWarningLabel, ERROR_CARD); myLayout.show(panel, ERROR_CARD); myPainter = new AbstractPainter() { @Override public boolean needsRepaint() { return true; } @Override public void executePaint(Component component, Graphics2D g) { if (myDescriptionTextField.isShowing()) { GraphicsUtil.setupAntialiasing(g); g.setColor(JBColor.GRAY); g.drawString(IdeBundle.message("hint.scheme.editing"), 0, -JBUIScale.scale(5)); } } }; IdeGlassPaneUtil.installPainter(panel, myPainter, this); return panel; }