Answer:

Yes.

Setting the Layout Manager

Here is how to set the layout manager for our JFrame:

import java.awt.*;
. . .
 
public class ButtonFrame  extends JFrame
{
  JButton bChange; 

  ButtonFrame()     
  {
    bChange = new Button("Click Me!"); 
    // choose the layout manager
    getContentPane().setLayout( new FlowLayout() ); 
    getContentPane().add( bChange );
    setDefaultCloseOperation( WindowConstants.EXIT_ON_CLOSE );
  }
}

The layout manager is set using the setLayout() method of the content pane.

QUESTION 8:

If there is only one component to place in a content pane, where do you suppose FlowLayout puts it?