Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2010
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.27 KB | None | 0 0
  1. package intro;
  2.  
  3. import java.awt.Image;
  4. import java.beans.*;
  5.  
  6. public class RectBeanInfo extends SimpleBeanInfo
  7.  
  8. {
  9.     Class beanClass = Rect.class;  //  @jve:decl-index=0:
  10.     String iconColor16x16Filename;
  11.     String iconColor32x32Filename;
  12.     String iconMono16x16Filename;
  13.     String iconMono32x32Filename;
  14.  
  15.     public RectBeanInfo() {
  16.  
  17.     }
  18.  
  19.     public PropertyDescriptor[] getPropertyDescriptors()
  20.  
  21.     {
  22.         try
  23.         {
  24.             PropertyDescriptor _myHeight = new PropertyDescriptor(
  25.                     "myHeight", beanClass, "getMyHeight", "setMyHeight");
  26.  
  27.             PropertyDescriptor _myWidth = new PropertyDescriptor(
  28.                     "myWidth", beanClass, "getMyWidth", "setMyWidth");
  29.  
  30.             PropertyDescriptor _myXStart = new PropertyDescriptor(
  31.                     "myXStart", beanClass, "getMyXStart", "setMyXStart");
  32.  
  33.             PropertyDescriptor _myYStart = new PropertyDescriptor(
  34.                     "myYStart", beanClass, "getMyYStart", "setMyYStart");
  35.  
  36.            PropertyDescriptor[] pds = new PropertyDescriptor[] {
  37.  
  38.                                        _myHeight,
  39.                                        _myWidth,
  40.                                        _myXStart,
  41.                                        _myYStart
  42.  
  43.             };
  44.  
  45.             return pds;
  46.  
  47.         } catch (Exception exception)
  48.  
  49.         {
  50.  
  51.             exception.printStackTrace();
  52.  
  53.             return null;
  54.  
  55.         }
  56.  
  57.     }
  58.  
  59.  
  60.  
  61.     public Image getIcon(int iconKind)
  62.  
  63.     {
  64.  
  65.         switch (iconKind)
  66.  
  67.         {
  68.  
  69.         case BeanInfo.ICON_COLOR_16x16:
  70.  
  71.             return ((iconColor16x16Filename != null)
  72.  
  73.                     ? loadImage(iconColor16x16Filename) : null);
  74.  
  75.  
  76.  
  77.         case BeanInfo.ICON_COLOR_32x32:
  78.  
  79.             return ((iconColor32x32Filename != null)
  80.  
  81.                     ? loadImage(iconColor32x32Filename) : null);
  82.  
  83.  
  84.  
  85.         case BeanInfo.ICON_MONO_16x16:
  86.  
  87.             return ((iconMono16x16Filename != null)
  88.  
  89.                     ? loadImage(iconMono16x16Filename) : null);
  90.  
  91.  
  92.  
  93.         case BeanInfo.ICON_MONO_32x32:
  94.  
  95.             return ((iconMono32x32Filename != null)
  96.  
  97.                     ? loadImage(iconMono32x32Filename) : null);
  98.  
  99.         }
  100.  
  101.  
  102.  
  103.         return null;
  104.  
  105.     }
  106.  
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement