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 Tab Order Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Tab Order" Watch "Tab Order" New topic
Author

Tab Order

Andy Holm
Ranch Hand

Joined: Jul 03, 2008
Posts: 86
I have a JTextField followed by a JTable followed by another JTextField and JTable. How do I set the tab order to go from one JTextField to the next without going to the JTables in between?
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
set your own FocusTraversalPolicy
Andy Holm
Ranch Hand

Joined: Jul 03, 2008
Posts: 86
Is there anyway to make this work on only a JPanel? I can get it to work on a JFrame but not just on a JPanel. I have many JPanels and don't want to have to create policies for all of them when only one needs the policy.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> Is there anyway to make this work on only a JPanel?

set the panel's policy, then add this line
panel.setFocusCycleRoot(true);

but the panel will be bypassed in the frame's traversalPolicy
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tab Order