package com.macfaq; import java.beans.*; import java.awt.*; public class URLWatcherBeanInfo extends SimpleBeanInfo { public BeanDescriptor getBeanDescriptor() { return new URLWatcherBeanDescriptor(); } public PropertyDescriptor[] getPropertyDescriptors() { PropertyDescriptor[] pd = new PropertyDescriptor[12]; try { pd[0] = new PropertyDescriptor("URL", URLWatcher.class); pd[0].setPropertyEditorClass(URLEditor.class); pd[1] = new PropertyDescriptor("RefreshInterval", URLWatcher.class); // two read-only properties pd[2] = new PropertyDescriptor("Text", URLWatcher.class, "getText", null); pd[3] = new PropertyDescriptor("Image", URLWatcher.class, "getImage", null); pd[4] = new PropertyDescriptor("LabelFont", URLWatcher.class); pd[4].setExpert(true); pd[5] = new PropertyDescriptor("TheURLFont", URLWatcher.class); pd[5].setExpert(true); pd[6] = new PropertyDescriptor("ThePageFont", URLWatcher.class); pd[7] = new PropertyDescriptor("UserCanEditURL", URLWatcher.class); pd[8] = new PropertyDescriptor("ShowReloadButton", URLWatcher.class); pd[9] = new PropertyDescriptor("ShowTheURL", URLWatcher.class); // properties inherited from java.awt.Panel pd[10] = new PropertyDescriptor("Foreground", URLWatcher.class); pd[11] = new PropertyDescriptor("Background", URLWatcher.class); } catch (IntrospectionException e) { System.err.println(e); e.printStackTrace(); return null; } return pd; } public int getDefaultPropertyIndex() { return 0; } public Image getIcon(int iconKind) { switch(iconKind) { case ICON_COLOR_16x16: return loadImage("URLWatcherColor16.gif"); case ICON_COLOR_32x32: return loadImage("URLWatcherColor32.gif"); case ICON_MONO_16x16: return loadImage("URLWatcherMono16.gif"); case ICON_MONO_32x32: return loadImage("URLWatcherMono32.gif"); default: return null; } } }