static JTextField onEnter(JTextField tf, final O action) { if (action == null || tf == null) ret tf; tf.addActionListener(actionListener(action)); ret tf; } static JButton onEnter(JButton btn, final O action) { if (action == null || btn == null) ret btn; btn.addActionListener(actionListener(action)); ret btn; } static JList onEnter(JList list, O action) { list.addKeyListener(enterKeyListener(action)); ret list; } static JComboBox onEnter(JComboBox cb, O action) { cb.addKeyListener(enterKeyListener(action)); ret cb; }