aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Dynamically updating frame has me stumped. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Dynamically updating frame has me stumped. " Watch "Dynamically updating frame has me stumped. " New topic
Author

Dynamically updating frame has me stumped.

Delbert Bell
Greenhorn

Joined: Jul 20, 2005
Posts: 6
Hello all,

I am new to java and am having trouble dynamically updating a frame.

Here is some sample code:



So basically, the frame starts out with two buttons. One in the north and one in the south. When I click on the one in the south I expect a new button to be added to the center of the frame, but nothing happens. However, if I uncomment the line in the actionPerformed method which changes the text of the south button then the center button also gets added (which is what I want). I am assuming it has something to do with changing the text on the south button forcing an update that doesn't otherwise occur but I can't figure out the mechanism. I would greatly appreciate any help.

Thanks!
Delbert Bell
Greenhorn

Joined: Jul 20, 2005
Posts: 6
I just needed to call the validate method on the frame. All is well now.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dynamically updating frame has me stumped.
 
Similar Threads
Adding drawpanels to a frame
coding a texteditor: want to open a separate option window
NullPointerException received trying to change the button label
How to handle events in java
Can't get an ActionListener to change a JLabel text