blob: da8274f56ab1c26f720f0cfa33b299cd6af37fe0 (
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
|
/* LightBulbLightOnEditor1.java */
import java.awt.*;
import java.beans.*;
public class LightBulbLightOnEditor1
extends PropertyEditorSupport
{
boolean currentvalue;
public void setValue(Object value)
{
currentvalue = ((Boolean)value).booleanValue();
}
public Object getValue()
{
return new Boolean(currentvalue);
}
public String getAsText()
{
return "" + (currentvalue ? "an" : "aus");
}
public void setAsText(String text)
throws java.lang.IllegalArgumentException
{
if (text.equalsIgnoreCase("an")) {
currentvalue = true;
} else if (text.equalsIgnoreCase("aus")) {
currentvalue = false;
} else {
throw new IllegalArgumentException(text);
}
firePropertyChange();
}
}
|