dcsimg
How to display two JPanels containing different components in the same space?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Shawn_Gates
Posted On:   Tuesday, April 23, 2002 07:51 PM

One area of my GUI needs to be able to change in response to JButton presses. One button should cause it to display an image and another button should cause it to display some text and another JButton. The area that needs to change is the top of a JSplitPane. I tried having two other classes inherit from JPanel having the layouts I needed. To help me explain, I'll call them imagePanel and infoPanel. I then made the top of the JSplitPane a JPanel and then in the event handling code of the JButtons, I made this JPanel equal to the needed panel(imagePanel or infoPanel): topPanel = (JPanel)imagePanel; What I'm not sure about is how to now make this panel display   More>>


One area of my GUI needs to be able to change in
response to JButton presses. One button should
cause it to display an image and another button
should cause it to display some text and another
JButton. The area that needs to change is the top
of a JSplitPane. I tried having two other classes inherit from JPanel having the layouts I needed.
To help me explain, I'll call them imagePanel and infoPanel. I then made the top of the JSplitPane a JPanel and then in the event handling
code of the JButtons, I made this JPanel equal to
the needed panel(imagePanel or infoPanel):

topPanel = (JPanel)imagePanel;

What I'm not sure about is how to now make this
panel display in the GUI since the GUI is already
visible. This may be a stupid question however, I am
fairly new to Java. I appreciate any help.

   <<Less

Re: How to display two JPanels containing different components in the same space?

Posted By:   frank_jania  
Posted On:   Wednesday, April 24, 2002 06:01 PM

try to do a foo.validate() where foo is the container which has the panels.
About | Sitemap | Contact