File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tab order in swing component

 
Raja Raja
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 88
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)));
}
}
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic