tags:

views:

46

answers:

1

Hi All,

I'm writing a game which uses a border layout with a JPanel using BorderLayout.CENTER. What I'd like to be able to do is sometimes hide this panel and replace it with another panel with different information. I added both to the container and set visibility of one of them to false.

Then later I try:

panel1.setVisible(false);
panel2.setVisible(true);

but this doesn't display the new panel. I just see gray. Any ideas?

TIA

+5  A: 

Use a nested JPanel with a CardLayout for that.

Michael Borgwardt
Thank you! I'm a Swing noob. Does it show?
Dan Howard