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

Answer:

Yes.


Setting the Layout Manager

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 program constructs a FlowLayout manager and then sets it using the setLayout() method of the frame. This is done before any components are added to the frame.


QUESTION 7:

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