SWING--Weird Occurrence!!!

I new and using swing components to develop my GUI. I have a frame with BorderLayout. I have created a panel that takes up the CENTER space of the frame. I have added a button (outside the center panel) which is supposed to change the center panel to another panel that has a label on it.

I have added an actionlistener to the button. The action listener creates and instance of a class that contains a method that creates a new panel and adds a label to it. I return the panel. Then inside the actionListener, I add the returned panel to the current center panel.

The Problem: When I click the button nothing happens. However, when I maximize the frame, the panel and label show up? I am not sure what is going on. All I can think about is that when I maximize the frame, it is repainting the screen and therefore showing the label. I have tried the repaint() method and update() method. No Luck with either of those.

I NEED SOME SERIOUS HELP!!!

Thanks,

Tom

[1005 byte] By [tomespo214] at [2007-9-26 2:19:28]
# 1
You may also want to try the pack() method.If this doesn't work, post the relevant code.
alee1010 at 2007-6-29 9:21:57 > top of Java-index,Archived Forums,New To Java Technology Archive...