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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With