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 in swing component Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Tab order in swing component" Watch "Tab order in swing component" New topic
Author

Tab order in swing component

Raja Raja
Greenhorn

Joined: May 17, 2003
Posts: 8
hi,
Can anyone tell me how to set the tab order in swing component.sample program would be more help ful.
Bhagya Tangutur
Ranch Hand

Joined: Oct 21, 2002
Posts: 88
do u mean...names on tabs must be in order...
if so...
while adding components to tabbedPane,you have to find out poistion of that index and add it to the JTabbedPane.
say you have panel names a,b,c,d....
you can sort all these panels first and add one after the other from some colelctions.
ex:
JPanel a=new JPanel();
a.setName("a");
JPanel b=new JPanel();
b.setName("b");

JPanel c=new JPanel();
c.setName("c");

JPanel d=new JPanel();
d.setName("d");
JTabbedPane tab=new Jtabbedpane();
say you have all these Panels in a vector.
you can sort it by their names using Comparator.
Vector vec=contains Panels sorted in the desired Order.
for(int i=0;i<vec.size();i++){
tab.add(((JPanel)vec.elementAt(i)).getName(),((JPanel)vec.elementAt(i)));
}
}


Sun Certified Java Programmer
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tab order in swing component
 
Similar Threads
NextFocusableComponent -> FocusTraversalPolicy
Default tab setting in Swing
Focus traversal through Disabled Controls
Tab head
Tabbing bewteen textfields