A good answer might be:

setSize( int width, int height)

The setResizable() Method

The setSize( int width, int height) method says what size the frame will start at, but once the frame is on the screen the user can change the size by dragging with the mouse. To prevent this, use this method:

setResizable( false );

Use true to allow resizing. Here is part of the program modified to prevent resizing:

public class percentFat extends Frame implements ActionListener
{
  . . . . . .

  public static void main ( String[] args )
  {
    percentFat fatApp  = new percentFat() ;

    WindowQuitter wquit = new WindowQuitter(); 
    fatApp.addWindowListener( wquit );
    
    fatApp.setSize( 280, 200 );
    fatApp.setResizable( false );   // user can't resize the frame
    fatApp.setVisible( true );      
    
  }

  . . . . . . .
}

Sometimes you want the user to be able to resize the frame, but certain components must remain together. For example, labels must remain next to the component that they describe.

QUESTION 3:

Wouldn't it be nice to have a LabeledButton component that consists of a Label and a Button that are always displayed next to each other?

Click Here after you have answered the question