I use two forms of JTextField in Java Swing. Now I enter the values โโin JTextField1 . Then, if I press ENTER , KEY means the cursor will move to JTextField2 . How to do it?
JTextField
JTextField1
JTextField2
Add an ActionListener to the first text box. In an ActionEvent you can get the source object, apply it to a JTextField and then call the transferFocus() method.
ActionListener
ActionEvent
transferFocus()
Use actionListener for textField .
actionListener
textField
Code snippet:
textField1.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ textField1.transferFocus(); } });
Source: https://habr.com/ru/post/1387321/More articles:how to convert request to json object in jquery - jsonDoes HL7 require SOAP? - soapConversion with a pointer to a pointer to a constant - c ++Error in blob class header file (openCV library) - header-filesHow to clear all navigation history posted using a WPF Frame control - wpfHow to fix the application does not respond? - androidGetting unique identifier without insertion - sqlForwarding the Zend Framework in the front controller plugin causes a redirect loop - redirectGood template for use with jquery - javascriptProblem with event.stopPropagation () & onClick (jQuery) - javascriptAll Articles