views:

75

answers:

2

Hello this is my question;

I have created 5 very similar panels that are suppuosed to be visible in the same area of a frane on at a time, What I mean is that when the app stars one of them (JPanel0) is visible and the other four are created but invisible and when i hit Button1, JPanel1 sets to visible and Jpanel0 goes invisible, same with all. I manage to get close with the BorderLayout But I cant get all of them to be centered in what would be the center position. Can someone help me? Thank you very much!

+5  A: 

Could CardLayout be what you may be looking for?

The Java Tutorials has an article on How to Use CardLayout, which includes an example which switches between a couple of JPanels which get swapped by using CardLayout.

coobird
beat me to it, +1CardLayout is IMO exactly what Ignacio is looking for
ammoQ
A: 

Another option would be to use OverlayLayout.

eugener