import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
To make the ENTER key act like the TAB key In java.
Changing the Focus When Pressing the Enter Key same as Tab key.
Swing Java code is.........................as follows.
import javax.swing.JTextField;
class MyTextField extends JTextField {
MyTextField(int len) {
super(len);
addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent evt) {
int key = evt.getKeyCode();
if (key == KeyEvent.VK_ENTER)
transferFocus();
}
});
}
}
How can i do the same for combo box and jspinner. I have all the controls in a container and i want to move from text field to combo box to jspinner and vice versa..kindly help.
ReplyDelete