File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Tab order in swing component

Raja Raja

Joined: May 17, 2003
Posts: 8
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.
JPanel a=new JPanel();
JPanel b=new JPanel();

JPanel c=new JPanel();

JPanel d=new JPanel();
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++){

Sun Certified Java Programmer
I agree. Here's the link:
subject: Tab order in swing component
It's not a secret anymore!