I have a few components in a JFrame: JTextField, JTree, JTable.
What listener and how I must create it in a JFrame, to
get focus on a next component, with my order list? Enter(or tab) will be a
suitable key.
Thank you
Wiseguy - 26 Feb 2005 21:18 GMT
Dado <mario_zupan@inet.hr> scribbled on the stall wall:
> I have a few components in a JFrame: JTextField, JTree, JTable.
> What listener and how I must create it in a JFrame, to
> get focus on a next component, with my order list? Enter(or tab) will be a
> suitable key.
> Thank you
One way is a keylistener for each component. when it sees the return
key it changes focus to the next component in the frame.
What's wrong with the <tab> key?
John McGrath - 27 Feb 2005 04:57 GMT
> I have a few components in a JFrame: JTextField, JTree, JTable.
> What listener and how I must create it in a JFrame, to
> get focus on a next component, with my order list? Enter(or tab) will be
> a suitable key.
The TAB key should change focus to the next component automatically. You
should not need to do anything to make this work. You can change the keys
that change the keyboard focus using the KeyboardFocusManager. See the
setDefaultFocusTraversalKeys() method.

Signature
Regards,
John McGrath