I'm expanding my program, which has no tabs at the moment. I've tried adding to tabs like so:
I declared it:
JTabbedPane mainTab = new JTabbedPane();
This is how I tried adding the two tabs:
mainTab.addTab("Main Tab", splitPane);
mainTab.addTab("Main2 Tab", splitPane);
getContentPane().add(mainTab);
This only added the last tab (main2), only one tab gets added.
any help is appropriated :)
A component can only be visible in a single container and it will only appear in the last container to which it was added. You need to create a new JSplitPane
instance along with new instances of its child components.