JTextField and JButton: share the same event handler
Mousa A. Rafi
Greenhorn
Joined: Jan 30, 2005
Posts: 28
posted
0
I've a JFrame that has a JTextField and a JButton object. After typing something in the Textfield I want the JButton to be clicked when I hit Enter. How can I do it? Does it have something to do with Actions?
This is one of several ways. You could also create an Action and give both components and instance of said Action. Most of the code would look the same though.