An Easy JTabbedPane - TabbedComponent

Update: March 31st, 2008

This Java class extends the JTabbedPane object and makes it easy to create an object that has multiple tabs. It also supports the simple adding of components to any tab.

TabbedComponent

View/download the class tabbedcomponent.java.

Explanation

The code is pretty well commented and should be somewhat self explanatory, but I will describe some of the main methods here.

class Test(){
public static void main(String[] args){
 
  TabbedComponent tab = new TabbedComponent(JTabbedPane.BOTTOM);
 
  tab.setSize(500,500); //set the size to 500x500
 
  int id = tab.makeNewPanel();
 
  tab.addLabeledRow(id, new JLabel("This is tab 1"), new JLabel("label 2"));
 
  tab.addTab("This is tab1", pid);
 
  }
}

tabbedcomponentexample.java

That's all it takes to make nicely tabbed user interfaces in Java. If you have any questions just post in the comments and I'll try to help you out. Have fun.

No comments yet.
TOP