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


public class Layout2 extends JFrame {

  JLabel jLabel1 = new JLabel();
  JTextField TEdit1 = new JTextField("TEdit1 (60%)");
  JTextField TEdit2 = new JTextField("TEdit2 (40%)");
  JTextField TEdit3 = new JTextField("TEdit3 (30%)");
  JTextField TEdit4 = new JTextField("TEdit4 (70%)");
  JTextField TEdit5 = new JTextField("TEdit5 (30%)");
  JLabel jLabel2 = new JLabel();

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


  public Layout2() {
    setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    setGUI();
  }

  private void setGUI() {
    setSize(500, 250);
    setTitle("2. Beispiel GridbagLayout");


    jLabel1.setText("1. Label");
    jLabel2.setText("2. Label");

    jLabel1.setFont( new Font("Arial", Font.BOLD,18)  );
    jLabel2.setFont( new Font("Arial", Font.BOLD,18)  );

    TEdit1.setFont( new Font("Arial", Font.BOLD,18)  );
    TEdit2.setFont( new Font("Arial", Font.BOLD,18)  );
    TEdit3.setFont( new Font("Arial", Font.BOLD,18)  );
    TEdit4.setFont( new Font("Arial", Font.BOLD,18)  );
    TEdit5.setFont( new Font("Arial", Font.BOLD,18)  );

    BnOk.setFont( new Font("Arial", Font.BOLD,18)  );
    BnESC.setFont( new Font("Arial", Font.BOLD,18)  );

  

  this.getContentPane().setLayout( new GridBagLayout() );

  

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

 

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

 
  } // setGUI


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

}  // Layout1


