go to previous page   go to home page   go to next page


See the buttons.

Size of the Frame

The layout manager for this GUI is FlowLayout, which means that the components are placed in the Frame left to right in rows starting at the top. As many components as can fit go into the first row, even if this means separating a label from its button:

wide frame

To get the GUI to look right, the width and height have to be set correctly:

fatApp.setSize( 280, 200 );     

This is a matter of trial-and-error. There are better ways to do this using features of Swing discussed in the following chapters. Another useful thing to do is to give the entire frame a title. This is done with:

setTitle( String title )

Now the top bar of the frame (the one that contains the "close button") has this title. In previous examples this was done by calling the superclass constructor with the title string.


Suggest a good title for the frame.