According to here, you can do something like this:
// Create the tabbed pane
JTabbedPane pane = new JTabbedPane();
// Add tabs...; see Adding a Tab to a JTabbedPane Container
// Register a change listener
pane.addChangeListener(new ChangeListener() {
// This method is called whenever the selected tab changes
public void stateChanged(ChangeEvent evt) {
JTabbedPane pane = (JTabbedPane)evt.getSource();
// Get current tab
int sel = pane.getSelectedIndex();
}
});
Then, use some switch statement to direct the flow of the program.
Continuation: Last time I used a JTabbedPane in Netbeans, all that I had to do was to add a new tab and simply build the gui for it. If you are having trouble with this, you might want to take a look at the Card Layout.
If you go through the tabs on the right hand side of your development screen, you should come accross a list of events. What you need to do is to select the appropriate event from that list and Netbeans will do it for you. On the other hand, you can open the .java file (while not open in netbeans) with a text editor (WordPad, NotePad++, etc) modofiy the code you want and save it. When you will open the file back through netbeans, you should see that your changes have been loaded as well.