I have a JMenuBar
and I have a JTabbedPane
, when I create multiple tabs the JMenuBar
does it on all the tabs, e.g. I open a file it opens the same file in each tab.
However I only want it to open a file on the current tab. I have added a ChangeListener
so It know what tab its in however it does not seem help even though it works.
tabbedPane.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
System.out.println("Tab=" + tabbedPane.getSelectedIndex());
}
});
getContentPane().add(tabbedPane, "Center");
pack();
I want to be able to have multiple tabs open while the menu bar only corresponds to current tab.