wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes How to change the tab order for jumping from one textfield to another Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to change the tab order for jumping from one textfield to another" Watch "How to change the tab order for jumping from one textfield to another" New topic
Author

How to change the tab order for jumping from one textfield to another

Ulrich Heeger
Ranch Hand

Joined: Jun 06, 2003
Posts: 266
Hi everyone,
I have a problem. Within my JPanel I have several textfields and one button.
Because the button is located right of my first textfield, when I use the tab key the focus is jumping from the first textfield to the button. But I want the focus to jump from the first to the second textfield. Because I don't want to change the visual order of my components, do you have any idea?
Regards,
ulrich
Peter Taucher
Ranch Hand

Joined: Nov 18, 2006
Posts: 174
FocusTraversalPolicy:
http://java.sun.com/j2se/1.5.0/docs/api/java/awt/FocusTraversalPolicy.html

Example:
http://java.sun.com/docs/books/tutorial/uiswing/misc/focus.html#customFocusTraversal


Censorship is the younger of two shameful sisters, the older one bears the name inquisition.
-- Johann Nepomuk Nestroy
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
use a custom FocusTraversalPolicy

http://java.sun.com/docs/books/tutorial/uiswing/misc/focus.html#customFocusTraversal
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42031
    
  64
Peter and Michael, you guys have karma - the same link at the same time - cool


Ping & DNS - my free Android networking tools app
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
it was the full moon!
Ulrich Heeger
Ranch Hand

Joined: Jun 06, 2003
Posts: 266
Hi Peter, Michael, Ulf,
sorry, that I haven't answered earlier. I haven't been in the office since friday. Thanks a lot for your help,
regards,
Ulrich
 
GeeCON Prague 2014
 
subject: How to change the tab order for jumping from one textfield to another