"Also, i am not able to figure out shall i go for Tabbed Pane or Card Layout?"
It really depends on your preference of the look of your program. The two layouts perform very similarly, though CardLayout
is a little bit more code, though at all not difficult. If you don't want the tab look, which I don't see why you would, for a game, then go with CardLayout
"How this can be achieved using existing JPanels without affecting current functionality? "
You need to create separate
JPanel
for each containment of whatever components you want in each tab. Then just add thoseJPanel
to theJTabbedPane
. It shouldn't break any functionality, just the look. Components from another panel should not be affected, you just won't be able to see any changes made, unless that other panel is in view.If you want to go with
CardLayout
you can look at the tutorial