
import java.awt.*;
import javax.swing.*;


// FlowLayout mit Schaltern

public class FlowLayout1 extends JFrame {


  //Frame konstruieren
  public FlowLayout1() {
    setSize(400, 300);
    setTitle("FlowLayout1");
    setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    setGUI();
  } // create

  private void setGUI() {
    JButton bn;

    // FlowLayout.LEFT
    this.getContentPane().setLayout ( 
      new FlowLayout(FlowLayout.CENTER) );

    for (int i=0; i<5; i++) {
      bn = new JButton(
         "Item: "+Integer.toString(i+1)  );
      this.getContentPane().add(bn);
    }
    for (int i=0; i<5; i++) {
      this.getContentPane().add(new JButton("Item2: "+Integer.toString(i+1)  )
        );
    }
   } // setGUI


  public static void main(String[] args) {
    FlowLayout1 frame = new FlowLayout1();
    frame.setVisible(true);
  }


}
