Link to home
Start Free TrialLog in
Avatar of stepma
stepma

asked on

Tab order control...

I have a panel which contains textfields and choice list components.  The default tab order is whatever order that the components are added, but I want to change that.  What is the best way to override the default tab ordering and create your own tab ordering?
Avatar of aziz061097
aziz061097

The order of add statements defines the Tab order. Just change the order of the add statements . If you want the display in a particular format use some layout manager to place the componenents as you want but the add statements must be in the order of your tab sequence
Another way to do it that I haven't tried but just came to think about is to catch KeyEvents for the Panel and use setFocus() method calls to control the order it the key pressed is tab.
ASKER CERTIFIED SOLUTION
Avatar of dufort
dufort

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You can seperate focus traversal into a focusmanager class to which you will give a list of components. To change focus traversal order, pass the same list again in a different order. The focusmanager implements focus listener interface and traverses the focus using requestFocus if the registered listeners on focus traversal agree for that.