home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 39 / IOPROG_39.ISO / SOFT / sdkjava40.exe / data1.cab / fg_Samples / Samples / ActiveX / JCalendar / JCalendarBeanInfo.java < prev    next >
Encoding:
Java Source  |  2000-05-04  |  3.3 KB  |  88 lines

  1. ///////////////////////////////////////////////////////////////////////////
  2. //
  3. //  JCalendarBeanInfo.java
  4. //
  5. //  This contains information about the JCalendar bean for developers.
  6. //
  7. //  (C) Copyright 1995 - 1999 Microsoft Corporation.  All rights reserved.
  8. //
  9. ///////////////////////////////////////////////////////////////////////////
  10.  
  11. import java.beans.*;
  12. import java.awt.*;
  13. import java.io.*;
  14.  
  15.  
  16. public class JCalendarBeanInfo extends SimpleBeanInfo implements Serializable
  17. {
  18.     /**
  19.      * Return the icon for this bean
  20.      * 
  21.      * @param   int     whether 16x16 pixels or 32x32
  22.      * @return  Image   The image icon for the calendar
  23.      */
  24.     public Image getIcon(int iconKind)
  25.     {
  26.         if(iconKind == BeanInfo.ICON_COLOR_16x16)        
  27.             return loadImage("JCalendarIcon16.gif");
  28.         
  29.         if(iconKind == BeanInfo.ICON_COLOR_32x32)
  30.             return loadImage("JCalendarIcon32.gif");
  31.  
  32.         return null;
  33.     }
  34.  
  35.  
  36.     /**
  37.      * Returns the list of properties associated with the Calendar and
  38.      * specifies their editors.
  39.      */
  40.  
  41.     public PropertyDescriptor[] getPropertyDescriptors()
  42.     {
  43.         // watch out for IntrospectionException
  44.         try
  45.         { 
  46.             // Create a property descriptor for each of the properties.
  47.             PropertyDescriptor 
  48.                 circleActiveDate = new PropertyDescriptor("circleActiveDate", JCalendar.class),
  49.                 date = new PropertyDescriptor("date", JCalendar.class),
  50.                 month = new PropertyDescriptor("month", JCalendar.class),
  51.                 showHorizontalLines= new PropertyDescriptor("showHorizontalLines", JCalendar.class),
  52.                 showOutline = new PropertyDescriptor("showOutline", JCalendar.class),
  53.                 showVerticalLines = new PropertyDescriptor("showVerticalLines", JCalendar.class),
  54.                 year = new PropertyDescriptor("year", JCalendar.class),
  55.                 font = new PropertyDescriptor("font", JCalendar.class),
  56.                 foreground = new PropertyDescriptor("foreground", JCalendar.class),
  57.                 background = new PropertyDescriptor("background", JCalendar.class);
  58.  
  59.  
  60.             // give a brief description of each of these properties.
  61.             circleActiveDate.setShortDescription("Is the displayed date to be circled or not");
  62.             date.setShortDescription("The day of the month which is to be displayed");
  63.             month.setShortDescription("The month to be displayed");
  64.             // TODO: add more descriptios here.
  65.             
  66.             // Define a new property editor for the month property
  67.             month.setPropertyEditorClass(JCalendarMonthEditor.class);
  68.  
  69.             // define a new property editor for the year property
  70.             year.setPropertyEditorClass(JCalendarYearEditor.class);
  71.  
  72.             // create an array of property descriptors.
  73.             PropertyDescriptor[] pd = { circleActiveDate, date, month, 
  74.                 showHorizontalLines, showOutline, showVerticalLines, year,
  75.                     font, foreground, background};
  76.  
  77.             return pd;
  78.         }
  79.  
  80.         catch (IntrospectionException e)
  81.         {
  82.             throw new Error(e.toString() + "In getPropertydescriptor()");
  83.         }
  84.        
  85.     }
  86.  
  87. }
  88.