home *** CD-ROM | disk | FTP | other *** search
/ BUG 15 / BUGCD1998_06.ISO / aplic / jbuilder / jsamples.z / InternationalClockBeanInfo.java < prev    next >
Encoding:
Java Source  |  1997-07-30  |  3.5 KB  |  95 lines

  1. package borland.samples.intl.beans;
  2.  
  3. import java.awt.*;
  4. import java.beans.*;
  5. import java.util.*;
  6.  
  7. import borland.jbcl.editors.*;
  8.  
  9. public class InternationalClockBeanInfo extends SimpleBeanInfo {
  10.  
  11.   ResourceBundle resourceBundle = ResourceBundle.getBundle("borland.samples.intl.beans.resources.InternationalClockRes");
  12.  
  13.   public PropertyDescriptor[] getPropertyDescriptors() {
  14.     try {
  15.       PropertyDescriptor displayDate = new PropertyDescriptor("displayDate",
  16.                                InternationalClock.class);
  17.       displayDate.setShortDescription(resourceBundle.getString("displayDate"));
  18.  
  19.       PropertyDescriptor displayTime = new PropertyDescriptor("displayTime",
  20.                                InternationalClock.class);
  21.       displayTime.setShortDescription(resourceBundle.getString("displayTime"));
  22.  
  23.       PropertyDescriptor dateStyle = new PropertyDescriptor("dateStyle",
  24.                                InternationalClock.class);
  25.       dateStyle.setPropertyEditorClass(InternationalClockDisplayStyleEditor.class);
  26.       dateStyle.setShortDescription(resourceBundle.getString("dateStyle"));
  27.  
  28.       PropertyDescriptor timeStyle = new PropertyDescriptor("timeStyle",
  29.                                InternationalClock.class);
  30.       timeStyle.setPropertyEditorClass(InternationalClockDisplayStyleEditor.class);
  31.       timeStyle.setShortDescription(resourceBundle.getString("timeStyle"));
  32.  
  33.       PropertyDescriptor locale = new PropertyDescriptor("locale",
  34.                                InternationalClock.class);
  35.  
  36.       PropertyDescriptor alignment = new PropertyDescriptor("alignment",
  37.                                InternationalClock.class);
  38.       alignment.setPropertyEditorClass(InternationalClockAlignmentEditor.class);
  39.  
  40.       PropertyDescriptor background = new PropertyDescriptor("background",
  41.                                InternationalClock.class);
  42.  
  43.       PropertyDescriptor foreground = new PropertyDescriptor("foreground",
  44.                                InternationalClock.class);
  45.  
  46.       PropertyDescriptor font = new PropertyDescriptor("font",
  47.                                InternationalClock.class);
  48.  
  49.       PropertyDescriptor bevelInner = new PropertyDescriptor("bevelInner",
  50.                                InternationalClock.class);
  51.       bevelInner.setPropertyEditorClass(BevelTypeEditor.class);
  52.  
  53.       PropertyDescriptor bevelOuter = new PropertyDescriptor("bevelOuter",
  54.                                InternationalClock.class);
  55.       bevelOuter.setPropertyEditorClass(BevelTypeEditor.class);
  56.  
  57.       PropertyDescriptor margins = new PropertyDescriptor("margins",
  58.                                InternationalClock.class);
  59.  
  60.       PropertyDescriptor clockEnabled = new PropertyDescriptor("clockEnabled",
  61.                                InternationalClock.class);
  62.  
  63.       PropertyDescriptor propertyDescriptor[] = { displayDate, displayTime, dateStyle, timeStyle,
  64.                           alignment, locale, background, foreground, font,
  65.                           bevelInner, bevelOuter, margins, clockEnabled };
  66.       return propertyDescriptor;
  67.     } catch (Exception ex) {
  68.       System.err.println("unexpected exeption: " + ex);
  69.       return null;
  70.     }
  71.   }
  72.  
  73.   public EventSetDescriptor[] getEventSetDescriptors() {
  74.     try {
  75.       EventSetDescriptor[] eventDescriptor = new EventSetDescriptor[0];
  76.       return eventDescriptor;
  77.     } catch (IntrospectionException e) {
  78.       e.printStackTrace();
  79.       return null;
  80.     }
  81.   }
  82.  
  83.   public BeanDescriptor getBeanDescriptor() {
  84.     return new BeanDescriptor(InternationalClock.class);
  85.   }
  86.  
  87.   public Image getIcon(int iconKind) {
  88.     if (iconKind == BeanInfo.ICON_COLOR_32x32) {
  89.       return loadImage("resources/InternationalClockIconColor32.gif");
  90.     }
  91.     return null;
  92.   }
  93.     
  94. }
  95.