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.
posted 10 years ago
I just needed to call the validate method on the frame. All is well now.