//Titel:	       Dialog-Fenster mit Action-Listener
//Version:	    1.0
//Copyright:	 (c) 2011, 25.10.2011 
//Autor:	       by M. Wilhelm
//Organisation: HS-Harz
//Beschreibung: Zeigt den Action-Listener mit realer Instanz


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


public class Action3 extends JFrame {

  JButton BnOk = new JButton("Ok");

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

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

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


	JPanel pnButton = new JPanel();
	//pnButton.setBackground(Color.red);
	pnButton.setLayout( new FlowLayout() );
	pnButton.add(BnOk);

   this.getContentPane().add( pnButton, BorderLayout.SOUTH );
    // erzeugen eines separatem ActionListener
   ActionListener al = new java.awt.event.ActionListener() {
     public void actionPerformed(ActionEvent e) {
         BnOk_Click();
     }
   }; 
    // Eintragen des Listeners
   BnOk.addActionListener(al);

  } // setGUI

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

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

}  // Action3


