Java GUI Help

txrandom

Diamond Member
Aug 15, 2004
3,773
0
71
Say I have a frame with two panels A & B. But now I want to just show one panel, so I type remove(A); but panel A still shows up. How do I actually remove the panel from the frame?

Do I need to remove(A); and then "refresh" the window? How do I do that?



 
Mar 19, 2003
18,289
2
71
It's been ages since I've done GUI stuff in Java...let me guess, CPSC 111? :p

As I recall, you had to paint/repaint the window after removing an object...I couldn't tell you what the method name was, though. Look it up in the API. ;)
 

mundane

Diamond Member
Jun 7, 2002
5,603
8
81
If you're going to be doing this often, use the JLayeredPane. You can bring different layers to front, back, reorder, with a single call.