Folks, Please explain me this unexpected behaviour.
When I run this code nothing is visible but I expected a button occupying the entire frame. but to my surprise I found that a blank frame with the size appeared. But when I resized the frame manually the button came with a splash..surprising. Also when I change the order of setVisible and setSize it comes correctly. Why does the order of specification play a role here. Can anybody please explain
Kishan - The default size of the frame is very small so when you do a setVisible() Java tries to display a tiny frame (just remove your setSize() and see). When you call setSize() the Frame changes size, but does not redraw it's contents unless specifically told to. (via setVisible() again) So, it's a good idea to call setSize() then setVisible(). BTW - try this code... it's pretty fun...
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop