Is it possible to have a frame where by a new panel in that frame refreshes to the next panel, if you click the 2 link for example.
Is there easy code for this?
The picture below illustrates this better.
Is it possible to have a frame where by a new panel in that frame refreshes to the next panel, if you click the 2 link for example.
Is there easy code for this?
The picture below illustrates this better.
You'll want to use a CardLayout, this is what it's designed for. It will allow you to switch out different components based on your needs
Check out How to use CardLayout for more info
Is there easy code for this?
That's a little subjective, but I would say CardLayout
is the simplest of the possible solitons
try this,
MainPanel.revalidate();
MainPanel.add(SecondPanel);
MainPanel.revalidate();
firstPanel.setVisible(false);
SecondPanel.setVisible(true);
validate();