I create a jTabPanl with 3 tab: add, update, remove for example. It can be if I click on each tab, it show index tab such as:
- click on Add tab, it do
System.out.println("clicking tab 0")
- click on Update tab, it do
System.out.println("clicking tab 1")
- click on Delete tab, it do
System.out.println("clicking tab 3")
Can anyone help me?
Finally, I do it:
ChangeListener changeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
jTabbedPane1 = (JTabbedPane) e.getSource();
int index = jTabbedPane1.getSelectedIndex();
System.out.println("click tab " + index);
}
};
jTabbedPane1.addChangeListener(changeListener);