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

Answer:

Yes.

Setting the Layout Manager

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

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

  ButtonFrame(String title) 
  {
    super( title );                      
    setLayout( new FlowLayout() );      // set the layout manager

    bChange = new JButton("Click Me!");  
    add( bChange );                      
    setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );   
  }

}

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

QUESTION 7:

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