void () { super.installListeners(); JTextComponent passwordField = getComponent(); focusListener = new FocusListener() { @Override public void focusGained(FocusEvent e) { passwordField.repaint(); } @Override public void focusLost(FocusEvent e) { passwordField.repaint(); } }; passwordField.addFocusListener(focusListener); }