• Post Reply Bookmark Topic Watch Topic
  • New Topic

JPanel Doesn't Display

 
marc bowden
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
I have 3 jpanels side by side within a jframe. One big and 2 small. The idea is to be able to toggle the contents of the big panel between the contents of the 2 small panels. I'm using 1.1.8 btw.
In the big panel I do .removeAll and then I do .add(A | B)
- where A or B is one of the small panel objects.
I also have 2 buttons to select �pane a or b.
The whole frame thus visually looks like:
bigPanel panelA panelB buttonA buttonB
If I press buttonA then bigPanel gets cleared (there's
a dummy text label in there so I can see this happen)
but panela does not appear in big panel.
I then press button B and nothing visually happens.
If I then resize the *frame* and carry pressing my
buttons everything works as I expected it to in the first
place ie the big panel gets panelA or B depending on the
button.
What is happening here?
Marc
 
Fatos Maxhuni
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you add/remove components from a container you need to vaildate it. so call validate(); on the container

Originally posted by marc bowden:
Hi All
I have 3 jpanels side by side within a jframe. One big and 2 small. The idea is to be able to toggle the contents of the big panel between the contents of the 2 small panels. I'm using 1.1.8 btw.
In the big panel I do .removeAll and then I do .add(A | B)
- where A or B is one of the small panel objects.
I also have 2 buttons to select �pane a or b.
The whole frame thus visually looks like:
bigPanel panelA panelB buttonA buttonB
If I press buttonA then bigPanel gets cleared (there's
a dummy text label in there so I can see this happen)
but panela does not appear in big panel.
I then press button B and nothing visually happens.
If I then resize the *frame* and carry pressing my
buttons everything works as I expected it to in the first
place ie the big panel gets panelA or B depending on the
button.
What is happening here?
Marc

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!