//Titel:            Dialog-Fenster
//Version:
//Copyright:		Copyright (c) 2010
//Autor:
//Organisation:
//Beschreibung:


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


public class test extends JFrame {

  JButton Bn1 = new JButton("Bn1");
  JButton Bn2 = new JButton("Bn2");
  JButton Bn3 = new JButton("Bn3");
  JButton Bn4 = new JButton("Bn4");
  JButton bnOk = new JButton("Ok");
  JButton bnEsc = new JButton("Abbruch");


  private JTextArea jtextarea;


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

  private void setGUI() {
    setSize(500, 430);
    setTitle("JFrame als Dialog");

    Bn1.setFont( new Font("Arial", Font.BOLD,18)  );
    Bn2.setFont( new Font("Arial", Font.BOLD,18)  );
    Bn3.setFont( new Font("Arial", Font.BOLD,18)  );
    Bn4.setFont( new Font("Arial", Font.BOLD,18)  );
    bnOk.setFont( new Font("Arial", Font.BOLD,18)  );
    bnEsc.setFont( new Font("Arial", Font.BOLD,18)  );
    bnOk.setPreferredSize( bnEsc.getPreferredSize() );

    this.getContentPane().setLayout( new BorderLayout() );
    jtextarea = new JTextArea("abc\ndef");
    this.getContentPane().add( new JScrollPane(jtextarea), BorderLayout.CENTER);

	JPanel pnButton = new JPanel();
	//pnButton.setBackground(Color.red);
	pnButton.setLayout( new FlowLayout() );
	pnButton.add(Bn1);
	pnButton.add(Bn2);
	pnButton.add(Bn3);
	pnButton.add(Bn4);
	pnButton.add(bnOk);
	pnButton.add(bnEsc);

    this.getContentPane().add( pnButton, BorderLayout.SOUTH );

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


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


  } // setGUI

    private void BnOk_Click() {
        System.out.println("Hier in Ok");
    }

    private void BnEsc_Click() {
        setVisible(false);
        dispose();  // System.exit(0);
    }







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

}  // test


