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


public class GridBagLayout01a extends JFrame {

  JLabel label1 = new JLabel();
  JLabel label2 = new JLabel("2. Label");
  JTextField text1 = new JTextField("1. textfeld");
  JTextField text2 = new JTextField("2. textfeld");
  JTextField text3 = new JTextField("3.Textfeld");

  JButton BnOk = new JButton("Ok");
  JButton BnEsc = new JButton("Abbruch");

  JPanel panel1 = new JPanel();

  public GridBagLayout01a() {
    setSize(400, 200);
    setTitle("GridBagLayout01. Beispiel, FlowPanel");
    setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    setGUI();
  }

  private void setGUI() {
   setLayout( new GridBagLayout() );
    label1.setText("Eingaben");
  

   BnOk.setFont( new Font("Arial", Font.BOLD,18)  );
   BnEsc.setFont( new Font("Arial", Font.BOLD,18)  );
   label1.setFont( new Font("Arial", Font.BOLD,18)  );
   text1.setFont( new Font("Arial", Font.BOLD,18)  );
   text2.setFont( new Font("Arial", Font.BOLD,18)  );
   text3.setFont( new Font("Arial", Font.BOLD,18)  );

    this.getContentPane().add(label1,
       new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
      ,GridBagConstraints.WEST,
      GridBagConstraints.NONE,
         new Insets(20,20,0,20), 0, 0));

    this.getContentPane().add(text1,
       new GridBagConstraints(1, 0, 2, 1, 100.0, 0.0
      ,GridBagConstraints.WEST,
      GridBagConstraints.HORIZONTAL,
         new Insets(20,0,0,20), 0, 0));


    this.getContentPane().add(label2,
       new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
      ,GridBagConstraints.WEST,
      GridBagConstraints.NONE,
         new Insets(20,20,0,20), 0, 0));

    this.getContentPane().add(text2,
       new GridBagConstraints(1, 1, 1, 1, 20.0, 0.0
      ,GridBagConstraints.WEST,
      GridBagConstraints.HORIZONTAL,
         new Insets(20,0,0,20), 0, 0));

  
    this.getContentPane().add(text3,
       new GridBagConstraints(2, 1, 1, 1, 60.0, 0.0
      ,GridBagConstraints.WEST,
      GridBagConstraints.HORIZONTAL,
         new Insets(20,0,0,20), 0, 0));

   JProgressBar  bar = new JProgressBar  ();
   
    this.getContentPane().add(bar,
       new GridBagConstraints(0, 2, 3, 1, 100.0, 0.0
      ,GridBagConstraints.WEST,
      GridBagConstraints.HORIZONTAL,
         new Insets(20,0,0,20), 0, 0));

   JPanel bnPanel = new JPanel();
   bnPanel.setBackground(Color.red);
   bnPanel.setLayout( new FlowLayout() );
   bnPanel.add(BnOk);
   bnPanel.add(BnEsc);

    this.getContentPane().add(bnPanel,
       new GridBagConstraints(0, 3, 3, 1, 100.0, 0.0
      ,GridBagConstraints.EAST,
      GridBagConstraints.HORIZONTAL,
         new Insets(20,0,10,0), 0, 0));

    }  //  setGUI


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

}

