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
------------------ Regards, V. Kishan Kumar
Regards,<BR>V. Kishan Kumar
bante
Greenhorn
Joined: Jun 19, 2000
Posts: 11
posted
0
I try your codes but it works fine on my machine. If I set the frame visiable before I set the size, I can see the frame (very small) and then it expands to the specified size immediately.
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...
-Nate
-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.