// 4. Beispiel ohne GridBagLayout


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

import java.awt.event.*;


public class GridBagLayout04 extends JFrame {

  JLabel jLabel1 = new JLabel();
  JTextField TName = new JTextField();

  JLabel jLabel2 = new JLabel();
  JTextField TMatrNr = new JTextField();
  JTextField TUNummer = new JTextField();

  JProgressBar jProgressBar1 = new JProgressBar();

  JButton BnUp = new JButton();
  JButton BnDown = new JButton();

  public GridBagLayout04() {
    setSize(420, 350);
    setTitle("GridBagLayout 04. Beispiel, ohne Layout");
    setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    setGUI();
  }

  private void setGUI() {
    this.getContentPane().setLayout( null );

    jLabel1.setText("Name");
    TName.setText("-");

    jLabel2.setText("Nummern");
    TMatrNr.setText("(Matr.-Nr)");
    TUNummer.setText("(Unummer)");

    jLabel1.setFont( new Font("Arial", Font.BOLD,18)  );
    jLabel2.setFont( new Font("Arial", Font.BOLD,18)  );
    TMatrNr.setFont( new Font("Arial", Font.BOLD,18)  );
    TUNummer.setFont( new Font("Arial", Font.BOLD,18)  );
    BnUp.setFont( new Font("Arial", Font.BOLD,18)  );
    BnDown.setFont( new Font("Arial", Font.BOLD,18)  );

    BnUp.setText("Up");
    BnUp.addActionListener(new java.awt.event.ActionListener() {

      public void actionPerformed(ActionEvent e) {
        BnUp_actionPerformed(e);
      }
    });
    BnDown.setText("Down");

    BnDown.addActionListener(
       new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        BnDown_actionPerformed(e);
      }
    });

    jProgressBar1.setMaximum(100);
    jProgressBar1.setMinimum(0);


    jLabel1.setBounds(21,18,70,20);  // x y width height
    TName.setBounds(140, 17, 250,20);  // x y width height
    this.getContentPane().add(jLabel1);
    this.getContentPane().add(TName);

    jLabel2.setBounds(21,89,100,20);  // x y width height
    TMatrNr.setBounds(140,87,100,20);  // x y width height
    TUNummer.setBounds(260, 87, 130,20);  // x y width height
    this.getContentPane().add(jLabel2);
    this.getContentPane().add(TMatrNr);
    this.getContentPane().add(TUNummer);

    jProgressBar1.setBounds(25, 199, 361, 23);  // x y width height
    this.getContentPane().add(jProgressBar1);

    BnUp.setBounds(91, 241, 100, 25);  // x y width height
    BnDown.setBounds(240, 240, 100, 25);  // x y width height
    this.getContentPane().add(BnDown);
    this.getContentPane().add(BnUp);

    jProgressBar1.setValue( 70 );

  } // setGUI



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



  void BnUp_actionPerformed(ActionEvent e) {
    jProgressBar1.setValue(  jProgressBar1.getValue()+1 );
  }

  void BnDown_actionPerformed(ActionEvent e) {
    jProgressBar1.setValue( jProgressBar1.getValue()-1 );
  }

}
