void (boolean focusable) { myLabel.setFocusable(focusable); remove(myLabel); remove(mySeparator); addComponents(focusable); if (focusable) { if (labelFocusListener == null) { labelFocusListener = new FocusListener() { @Override public void focusGained(FocusEvent e) { setLabelBorder(true); } @Override public void focusLost(FocusEvent e) { setLabelBorder(false); } }; myLabel.addFocusListener(labelFocusListener); setLabelBorder(false); } } else { if (labelFocusListener != null) { myLabel.removeFocusListener(labelFocusListener); labelFocusListener = null; } myLabel.setBorder(null); } }