Tag Archives: Swing

Swing Textfield selectAll without invokeLater

Get rid of the evil invokeLater. InvokeLater will pollute the UX design. private class SelectAllOfFocus extends FocusAdapter { @Override public void focusGained(FocusEvent e) { if (! e.isTemporary()) { JFormattedTextField textField = (JFormattedTextField)e.getComponent(); // This is needed to put the text field in edited mode, so that its processFocusEvent doesn’t // do anything. Otherwise, it calls… Read More »