Eine gute Antwort könnte sein:

Yes.

Setting the Layout Manager

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

import java.awt.*;
. . .

public class ButtonDemo extends JFrame
{
  Button bChange;

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

  public static void main ( String[] args )
  {
    ButtonDemo frm = new ButtonDemo();
      . . . . .
  }
}

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

FRAGE 8:

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

Inhaltsverzeichnis