I'm using two JTextField in Java Swing form. Now I enter the values in JTextField1. Next if I press ENTER KEY means the cursor move to JTextField2. How to do this?
JTextField
JTextField1
JTextField2
Add an ActionListener to the first text field. In the ActionEvent you can get the source object, cast it to a JTextField and then invoke the transferFocus() method.
ActionListener
ActionEvent
transferFocus()
2.1m questions
2.1m answers
60 comments
57.0k users