Sizing a Frame
[ Home ] [ Up ] [ Your First Frame ] [ Sizing a Frame ] [ Positioning a Frame ] [ Exiting a Program ] [ A Centered Frame ]

 

 

Sizing a Frame

If we had omitted the line:

setSize(300, 200);

which specifies the width (300) and height (200) of the frame, in units of pixels, we would have seen the following:

This tells us that the default width and height are both 0.   The fact that the title bar is displayed automatically ensures that something, at least, is visible.

It is a common mistake to forget to size the frame properly, and then wonder where the frame went when you run the program!

 

This page was last modified on 02 October, 2007