jSpinner not cooperating.

I have this jSpinner that I need to allow an "ENTER" key transfer focus to the next component and I'm using the following code:

jSpinner1.addKeyListener(new WorkOrders_jSpinner1_keyAdapter(this));

publicvoid jSpinner1_keyPressed(KeyEvent e){

int key = e.getKeyChar();

if (key == KeyEvent.VK_ENTER){

((Component) e.getSource()).transferFocus();

}

}

For some reason, this does not work. It works fine for other components, like a Textfield. Any ideas ?

[815 byte] By [dccgarya] at [2007-11-26 16:21:30]
# 1
Try having a println statement inside the keyPressed Event method. Basically, test to see if you are actually generating keyEvents.
Nethera at 2007-7-8 22:45:10 > top of Java-index,Desktop,Core GUI APIs...
# 2
Most probably it's the inner text field that gets the events and not the spinner itself.
kirillga at 2007-7-8 22:45:10 > top of Java-index,Desktop,Core GUI APIs...
# 3
[url http://java.sun.com/docs/books/tutorial/uiswing/misc/keybinding.html]How to Use Key Bindings[/url]
camickra at 2007-7-8 22:45:10 > top of Java-index,Desktop,Core GUI APIs...