How can I make invisible one of the panes in a tabbed pane?
I have one combo box and a tabbed pane. In the combo box, if I select '1' it should show only one tab; if I select '2', it should show two tabs.
How can I make it do that?
How can I make invisible one of the panes in a tabbed pane?
I have one combo box and a tabbed pane. In the combo box, if I select '1' it should show only one tab; if I select '2', it should show two tabs.
How can I make it do that?
On
Dynamically set your tab pane. write the tab pane adding code inside the combo box action code. Try to keep local variables for tabpane. If "1" is selected in combo box then clear the layout, add the new tab pane and re-validate. Do the same when "2" is clicked.
Other option is card layout, you can add whatever you like on top of it like in other layouts. Card Layout has a concept of "cards" which will only show when called.
Solution: don't use a JTabbedPane. If you want to swap components, use a CardLayout. Google the tutorial for more.