static void simulateEnter(final JTextField tf) { if (tf != null) swing { for (ActionListener a : tf.getActionListeners()) a.actionPerformed(new ActionEvent(tf, ActionEvent.ACTION_PERFORMED, null)); } }