File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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: 39544
    
  27
Peter and Michael, you guys have karma - the same link at the same time - cool


Ping & DNS - updated with new look and Ping home screen widget
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
 
wood burning stoves
 
subject: How to change the tab order for jumping from one textfield to another
 
Similar Threads
tabbing in JTable
Focus: cant find the relevant method
tabbing in JTable
form navigation
JTabbedPane Problem