blob: 7c81745c920008b6a24896bd6b17841a5d0ab522 (
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
|
/* LightBulbBeanInfo.java */
import java.awt.*;
import java.beans.*;
import java.lang.reflect.*;
public class LightBulbBeanInfo
extends SimpleBeanInfo
{
public Image getIcon(int iconKind)
{
String imgname = "bulbico16.gif";
if (iconKind == BeanInfo.ICON_MONO_32x32 ||
iconKind == BeanInfo.ICON_COLOR_32x32) {
imgname = "bulbico32.gif";
}
return loadImage(imgname);
}
public PropertyDescriptor[] getPropertyDescriptors()
{
try {
PropertyDescriptor pd1 = new PropertyDescriptor(
"lightOn",
LightBulb.class
);
//pd1.setPropertyEditorClass(LightBulbLightOnEditor1.class);
PropertyDescriptor[] ret = {pd1};
return ret;
} catch (IntrospectionException e) {
System.err.println(e.toString());
return null;
}
}
public MethodDescriptor[] getMethodDescriptors()
{
MethodDescriptor[] ret = null;
try {
Class bulbclass = LightBulb.class;
Method meth1 = bulbclass.getMethod("toggleLight", null);
ret = new MethodDescriptor[1];
ret[0] = new MethodDescriptor(meth1);
} catch (NoSuchMethodException e) {
//ret bleibt null
}
return ret;
}
}
|