This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.
Joined: Jul 20, 2005
I just needed to call the validate method on the frame. All is well now.