Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to set Tab Order

Status
Not open for further replies.

VenkatRastapuram

Programmer
Oct 24, 2003
46
IN
Hello Sir,

I developed an application. It contains many containers . I wanted to set Tab order to the containers.
How to set Tab TraversalCycle . How to set a container as a DefaultFocus whenever the application starts and how to set next focus to another container. Please Help me in this regard.

R.Venkatesh
MakeLogic
venkat@makelogicmldb.com
 
If you are using Swing and you don't like the default tabbing order, you can change the tabbing order of JComponents with the "setNextFocusableComponent" method.

for example :
Code:
JTextField textFields[] = new JTextField[6];
...
for (int i = 0; i < 5; i++) {
  textFields[i].setNextFocusableComponent(textFields[i+1]);
}
... 
textField[5].setNextFocusableComponent(buttonA);
buttonA.setNextFocusableComponent(buttonB);
buttonB.setNextFocusableComponent(buttonC);
...



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top