문제

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top