A KeyListener may be registered for key events with a TextField. When a key is pressed, the method keyPressed() of the KeyListener will be called with the KeyEvent as parameter.
Check this tutorial from sun.
http://java.sun.com/docs/books/tutorial/uiswing/events/keylistener.html addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent event) {
// look for tab keys
if(event.getKeyCode() == KeyEvent.VK_TAB|| event.getKeyChar() == '\t') {
// Your code goes here.
}
}
else {
//Your code goes here. }
}
});
[ March 29, 2005: Message edited by: Ankit Pedro ]