blob: a2e689a7890c9357257c01f1c136ed84bb94a287 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
/* 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);
}
}
|