/* * Copyright (c) 2007, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the distribution. * * Neither the name of Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package examples.colorpicker; import java.beans.*; /** BeanInfo for ColorPreview bean. */ public class ColorPreviewBeanInfo extends SimpleBeanInfo { // Property identifiers //GEN-FIRST:Properties private static final int PROPERTY_blue = 0; private static final int PROPERTY_green = 1; private static final int PROPERTY_red = 2; // Property array private static PropertyDescriptor[] properties = new PropertyDescriptor[3]; static { try { properties[PROPERTY_blue] = new PropertyDescriptor( "blue", ColorPreview.class, "getBlue", "setBlue" ); properties[PROPERTY_green] = new PropertyDescriptor( "green", ColorPreview.class, "getGreen", "setGreen" ); properties[PROPERTY_red] = new PropertyDescriptor( "red", ColorPreview.class, "getRed", "setRed" ); } catch( IntrospectionException e) {}//GEN-HEADEREND:Properties // Here you can add code for customizing the properties array. }//GEN-LAST:Properties // EventSet identifiers //GEN-FIRST:Events private static final int EVENT_propertyChangeListener = 0; // EventSet array private static EventSetDescriptor[] eventSets = new EventSetDescriptor[1]; static { try { eventSets[EVENT_propertyChangeListener] = new EventSetDescriptor( ColorPreview.class, "propertyChangeListener", java.beans.PropertyChangeListener.class, new String[] { "propertyChange" }, "addPropertyChangeListener", "removePropertyChangeListener" ); } catch( IntrospectionException e) {}//GEN-HEADEREND:Events // Here you can add code for customizing the event sets array. }//GEN-LAST:Events private static String ICON_COLOR_16x16 = null; //GEN-BEGIN:Icons private static String ICON_COLOR_32x32 = null; private static String ICON_MONO_16x16 = null; private static String ICON_MONO_32x32 = null; //GEN-END:Icons /** This methods returns an array of property descriptors. * @return Array of PropertyDescriptor instances associated with this BeanInfo. */ public PropertyDescriptor[] getPropertyDescriptors() { return properties; } /** This methods returns an array of event set descriptors. * @return Array of EventSetDescriptor instances associated with this BeanInfo. */ public EventSetDescriptor[] getEventSetDescriptors() { return eventSets; } java.awt.Image icon = loadImage("/tutorial/colorpicker/ColorPreview.gif"); /** This method returns this bean info icon, depending on given argument. * @param iconKind Type of icon. * @return Icon associated with this BeanInfo. */ public java.awt.Image getIcon(int iconKind) { switch (iconKind) { case java.beans.BeanInfo.ICON_COLOR_16x16: return icon; } return null; } }