import java.beans.*; import java.awt.*; public class SmileyBeanInfo extends SimpleBeanInfo { private final String ICON_FILENAME = "smiley.gif"; //------------------------------------------------------------------- // define a single smiley property: "emotion" + own PropEditor //------------------------------------------------------------------- public PropertyDescriptor[] getPropertyDescriptors() { PropertyDescriptor emotionPD = null; try { emotionPD = new PropertyDescriptor("emotion", Smiley.class); } catch (IntrospectionException badPD) { System.out.println("emotion PropertyDescriptor faulty."); System.exit(10); } // now associate a property editor purely for the "emotion" prop emotionPD.setPropertyEditorClass(SmileyEditor.class); PropertyDescriptor[] ePDs = {emotionPD}; return ePDs; } //------------------------------------------------------------------- // Define an icon to go along with our smiley bean. //------------------------------------------------------------------- public Image getIcon(int iconKind) { if ( iconKind == BeanInfo.ICON_COLOR_16x16 ) { return loadImage(ICON_FILENAME); } else { System.out.println("Smiley only has a 16x16 icon."); return null; } } } // End of Class SmileyBeanInfo