/* Listing4408.java */

import java.awt.*;
import java.awt.event.*;
import java.beans.*;

public class Listing4408
extends Frame
{
  public Listing4408()
  {
    //Initialisierung
    super("BeanPropertiesTest");
    setLayout(new FlowLayout());
    setBackground(Color.lightGray);
    addWindowListener(
      new WindowAdapter() {
        public void windowClosing(WindowEvent event)
        {
          System.exit(0);
        }
      }
    );
    //Dialogelemente hinzufügen
    LightedPushButton button1 = new LightedPushButton();
    VetoSwitch veto1 = new VetoSwitch();
    final LightBulb bulb1 = new LightBulb();
    add(button1);
    add(veto1);
    add(bulb1);
    button1.addPropertyChangeListener(
      new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent e)
        {
          if (e.getPropertyName().equals("lighton")) {
            Boolean on = (Boolean)e.getNewValue();
            bulb1.setLightOn(on.booleanValue());
          }
        }
      }
    );
    button1.addVetoableChangeListener(veto1);
  }

  //---main-------------------------------------------------
  public static void main(String[] args)
  {
    Listing4408 frm = new Listing4408();
    frm.setLocation(100, 100);
    frm.pack();
    frm.setVisible(true);
  }
}