I've started working on a Java desktop application using netbeans. I have 7 different screens and to represent them I am using JPanel. One JPanel to represent each of them and one to contain all of them(named as mainPanel), which is inside a JFrame. mainPanel uses Cardlayout for the purpose of switching between screens(JPanels). I built all this interface using netbeans ui widgets i.e. drag drop.
LayOut
JFrame
mainPanel (Jpanel) CardLayout
Child1 (JPanel)
Child2 (JPanel)
.
.
.
.
Childn (Jpanel)
I know that one can switch screens using JPanel.next() and Jpanel.previous. but they can only be used when switching is to be done among consecutive screens i.e. if you have to switch to an immediate neighbour. There's also a method JPanel.show() to go to a specific screen but problem is that it takes a parameter name which is a String you associate when you add it to mainPanel using JPanel.add() function. I've added everything using drag and drop, so I don't know what String gets associated, if it does.
Although it looks very primitive and I've already done it without Cardlayout but this time, Cardlayout is a requirement.
Help will be highly appreciated
