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


public class GridBagLayout_bsp extends JFrame {

  JLabel label1 = new JLabel("Eingabe");
  JTextField text1 = new JTextField("");

  JLabel label2 = new JLabel("Eingabe");
  JTextField text2 = new JTextField("");
  JTextField text3 = new JTextField("");
  
 JProgressBar prgBar = new JProgressBar();

  JButton bnOk = new JButton("Ok");
  JButton bnEsc = new JButton("Abbruch");

  JPanel panelBn = new JPanel();

  public GridBagLayout_bsp() {
    setSize(400, 250);
    setLocation(150,50);
    setTitle("GridBagLayout. Beispiel");
    setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    setGUI();
  }

  private void setGUI() {
    this.getContentPane().setLayout( new GridBagLayout() );

  
    //BnOk.setPreferredSize(  BnEsc.getPreferredSize() );

   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)  );
   label2.setFont( new Font("Arial", Font.BOLD,18)  );
   text2.setFont( new Font("Arial", Font.BOLD,18)  );
   text3.setFont( new Font("Arial", Font.BOLD,18)  );

  panelBn.setLayout ( new FlowLayout() );
   panelBn.add(bnOk);
   panelBn.add(bnEsc);

    this.getContentPane().add(   label1, 
       new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
      ,GridBagConstraints.WEST,
      GridBagConstraints.NONE,
         new Insets(20,20,20,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,20,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,20,20), 0, 0));

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

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

   prgBar.setValue(33);
 this.getContentPane().add(   prgBar, 
       new GridBagConstraints(0, 2, 3, 1, 100.0, 0.0
      ,GridBagConstraints.CENTER,
      GridBagConstraints.HORIZONTAL,
         new Insets(20,0,20,0), 0, 0));

    panelBn.setBackground(Color.RED);
    this.getContentPane().add(   panelBn, 
       new GridBagConstraints(0, 3, 3, 1, 100.0, 0.0
      ,GridBagConstraints.CENTER,
      GridBagConstraints.HORIZONTAL,
         new Insets(20,0,20,0), 0, 0));



    }  // setGUI


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

}

