FocusListener () { return new FocusListener() { @Override public void focusGained(FocusEvent e) { if (mySetValueModeEnabled) { disableSetValueMode(); } } @Override public void focusLost(FocusEvent e) { // do nothing } }; }