void () { addFocusListener(new FocusAdapter() { @Override public void focusGained(@NotNull FocusEvent e) { setBorder(wrapBorder(createFocusedBorder())); } @Override public void focusLost(@NotNull FocusEvent e) { setBorder(wrapBorder(createUnfocusedBorder())); } }); }