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

// Beispiel mit GridLayout
// In einer Zelle gibt es ein weiteres Grid

public class GridLayout4 extends JFrame {


  //Frame konstruieren
  public GridLayout4() {
    setSize(500, 300);
    setTitle("GridLayout4");
    setGUI();
    setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
  }

  private void setGUI() {
     JPanel panel;
     JButton bn;
     Integer I = new Integer(0);


    panel = new JPanel();
    panel.setLayout ( new GridLayout(3,5) );
    panel.setBackground( Color.red);
    this.getContentPane().add(panel, BorderLayout.CENTER);
    for (int i=0; i<17; i++) {
      if (i==0)  {
        JPanel panel2 = new JPanel();
        panel2.setLayout ( new GridLayout(5,1) );
        panel.add(panel2);
        for (int ii=0; ii<9; ii++) {
          bn = new JButton( Integer.toString(ii+1)  );
          bn.setFont( new Font("Arial", Font.BOLD,18)  );
          panel2.add(bn);
        }
      }
      else {
        bn = new JButton( Integer.toString(i+1)  );
        bn.setFont( new Font("Arial", Font.BOLD,18)  );
        panel.add(bn);
      }
    }
  } // create



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


}
