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

// JFrame mit RadionButtons
// Es kann jede RadionButton gesetzt werden


public class RadioButton01 extends JFrame {
  JLabel label;
  JRadioButton rb1;
  JRadioButton rb2;
  JRadioButton rb3;
  JRadioButton rb4;

  JRadioButton rb5;
  JRadioButton rb6;
  JRadioButton rb7;
  JRadioButton rb8;

  //Frame konstruieren
  public RadioButton01() {
    setSize(300, 200);
    setTitle("Radiobutton: RadioButton01");
    setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    setGUI();
  }

  void setGUI() {
    JPanel panel1;
    JLabel label1;
    JLabel label2;
    ButtonGroup group1;
    ButtonGroup group2;

    setSize(400, 300);

    label1 = new JLabel("1. Auswahl");
    label2 = new JLabel("2. Auswahl");
    label1.setFont( new Font("Arial", Font.BOLD,18)  );
    label2.setFont( new Font("Arial", Font.BOLD,18)  );

    rb1 = new JRadioButton("1. Wahl", false);
    rb2 = new JRadioButton("2. Wahl", true);
    rb3 = new JRadioButton("3. Wahl", false);
    rb4 = new JRadioButton("4. Wahl", false);

    rb5 = new JRadioButton("A. Wahl", false);
    rb6 = new JRadioButton("B. Wahl", true);
    rb7 = new JRadioButton("C. Wahl", true);
    rb8 = new JRadioButton("D. Wahl", false);

    rb1.setFont( new Font("Arial", Font.BOLD,18)  );
    rb2.setFont( new Font("Arial", Font.BOLD,18)  );
    rb3.setFont( new Font("Arial", Font.BOLD,18)  );
    rb4.setFont( new Font("Arial", Font.BOLD,18)  );
    rb5.setFont( new Font("Arial", Font.BOLD,18)  );
    rb6.setFont( new Font("Arial", Font.BOLD,18)  );
    rb7.setFont( new Font("Arial", Font.BOLD,18)  );
    rb8.setFont( new Font("Arial", Font.BOLD,18)  );

    panel1 = new JPanel();
    panel1.setLayout ( new GridLayout(5,2) ); // 5 Zeilen , 2 Spalten
    this.getContentPane().add(panel1, BorderLayout.CENTER);
    panel1.add( label1 );
    panel1.add( label2 );


    panel1.add( rb1 );
    panel1.add( rb5 );

    panel1.add( rb2 );
    panel1.add( rb6 );

    panel1.add( rb3 );
    panel1.add( rb7 );

    panel1.add( rb4 );
    panel1.add( rb8 );

	// GroupBox fehlt !

  } // setGUI




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


}


