How hide/remove all added JPanel in a JInternalFrame

Hi,

i got a problem

i have added 4 or 5 JPanel to the JinternalFrame

i want just 1 Jpanel should be in visible at a time.

i don't want to use setVisible(false) for every JPanel to hide them

can I hide all the JPanels with a single method and make visible the only one Panel which i want now

is it possible?

What abt removeAll() in JInternalFrame?

suggestions plssssssss.......

thank you

--Subbu

Message was edited by:

Subbu_java

[510 byte] By [Subbu_javaa] at [2007-11-27 0:47:44]
# 1
removeAll() will remove all the panels from Internal frame.I will suggest that, remove panels which you don't want to show...
Bnahirraoa at 2007-7-11 23:16:18 > top of Java-index,Desktop,Core GUI APIs...
# 2

thanks for the quick reply.

but i tried with removeAll() that's removing all the components in the InternalFrame. Also, after that we are not able to see any panels.

you said that, remove the panels which i don't want to show

you mean hiding them are removing them from InternalFrame.

Subbu

Subbu_javaa at 2007-7-11 23:16:18 > top of Java-index,Desktop,Core GUI APIs...
# 3

Remove all and add the one you want?

Or set all invisible and show the one you want?

Another suggestion of mine would be making an "interface" for the panel, like:

JPanel interfacePanel;

interfacePanel=defaultPanel;

mainPanel.add(interfacePanel);

when you want to change:

mainPanel.remove(interfacePanel);

interfacePanel=newPanel;

mainPanel.add(interfacePanel);

mainPanel.revalidate();

Icycoola at 2007-7-11 23:16:18 > top of Java-index,Desktop,Core GUI APIs...
# 4
[url http://java.sun.com/docs/books/tutorial/uiswing/layout/card.html]How to Use CardLayout[/url]
Rodney_McKaya at 2007-7-11 23:16:18 > top of Java-index,Desktop,Core GUI APIs...