home *** CD-ROM | disk | FTP | other *** search
/ PC World 1998 October / PCWorld_1998-10_cd.bin / software / prehled / inprise / JSAMPLES.Z / InternationalClockBeanInfo.java < prev    next >
Text File  |  1998-05-08  |  5KB  |  109 lines

  1. /*
  2.  * Copyright (c) 1997-1998 Borland International, Inc. All Rights Reserved.
  3.  * 
  4.  * This SOURCE CODE FILE, which has been provided by Borland as part
  5.  * of a Borland product for use ONLY by licensed users of the product,
  6.  * includes CONFIDENTIAL and PROPRIETARY information of Borland.  
  7.  *
  8.  * USE OF THIS SOFTWARE IS GOVERNED BY THE TERMS AND CONDITIONS 
  9.  * OF THE LICENSE STATEMENT AND LIMITED WARRANTY FURNISHED WITH
  10.  * THE PRODUCT.
  11.  *
  12.  * IN PARTICULAR, YOU WILL INDEMNIFY AND HOLD BORLAND, ITS RELATED
  13.  * COMPANIES AND ITS SUPPLIERS, HARMLESS FROM AND AGAINST ANY CLAIMS
  14.  * OR LIABILITIES ARISING OUT OF THE USE, REPRODUCTION, OR DISTRIBUTION
  15.  * OF YOUR PROGRAMS, INCLUDING ANY CLAIMS OR LIABILITIES ARISING OUT OF
  16.  * OR RESULTING FROM THE USE, MODIFICATION, OR DISTRIBUTION OF PROGRAMS
  17.  * OR FILES CREATED FROM, BASED ON, AND/OR DERIVED FROM THIS SOURCE
  18.  * CODE FILE.
  19.  */
  20. package borland.samples.intl.beans;
  21.  
  22. import java.awt.*;
  23. import java.beans.*;
  24. import java.util.*;
  25.  
  26. import borland.jbcl.editors.*;
  27.  
  28. public class InternationalClockBeanInfo extends SimpleBeanInfo {
  29.  
  30.   ResourceBundle resourceBundle = java.util.ResourceBundle.getBundle("borland.samples.intl.beans.resources.InternationalClockRes");
  31.  
  32.   public PropertyDescriptor[] getPropertyDescriptors() {
  33.     try {
  34.       PropertyDescriptor displayDate = new PropertyDescriptor("displayDate",
  35.                                                        InternationalClock.class);
  36.       displayDate.setShortDescription(resourceBundle.getString("displayDate"));
  37.  
  38.       PropertyDescriptor displayTime = new PropertyDescriptor("displayTime",
  39.                                                        InternationalClock.class);
  40.       displayTime.setShortDescription(resourceBundle.getString("displayTime"));
  41.  
  42.       PropertyDescriptor dateStyle = new PropertyDescriptor("dateStyle",
  43.                                                        InternationalClock.class);
  44.       dateStyle.setPropertyEditorClass(InternationalClockDisplayStyleEditor.class);
  45.       dateStyle.setShortDescription(resourceBundle.getString("dateStyle"));
  46.  
  47.       PropertyDescriptor timeStyle = new PropertyDescriptor("timeStyle",
  48.                                                        InternationalClock.class);
  49.       timeStyle.setPropertyEditorClass(InternationalClockDisplayStyleEditor.class);
  50.       timeStyle.setShortDescription(resourceBundle.getString("timeStyle"));
  51.  
  52.       PropertyDescriptor locale = new PropertyDescriptor("locale",
  53.                                                        InternationalClock.class);
  54.  
  55.       PropertyDescriptor alignment = new PropertyDescriptor("alignment",
  56.                                                        InternationalClock.class);
  57.       alignment.setPropertyEditorClass(InternationalClockAlignmentEditor.class);
  58.  
  59.       PropertyDescriptor background = new PropertyDescriptor("background",
  60.                                                        InternationalClock.class);
  61.  
  62.       PropertyDescriptor foreground = new PropertyDescriptor("foreground",
  63.                                                        InternationalClock.class);
  64.  
  65.       PropertyDescriptor font = new PropertyDescriptor("font",
  66.                                                        InternationalClock.class);
  67.  
  68.       PropertyDescriptor bevelInner = new PropertyDescriptor("bevelInner",
  69.                                                        InternationalClock.class);
  70.       bevelInner.setPropertyEditorClass(BevelTypeEditor.class);
  71.  
  72.       PropertyDescriptor bevelOuter = new PropertyDescriptor("bevelOuter",
  73.                                                        InternationalClock.class);
  74.       bevelOuter.setPropertyEditorClass(BevelTypeEditor.class);
  75.  
  76.       PropertyDescriptor margins = new PropertyDescriptor("margins",
  77.                                                        InternationalClock.class);
  78.  
  79.       PropertyDescriptor clockEnabled = new PropertyDescriptor("clockEnabled",
  80.                                                        InternationalClock.class);
  81.  
  82.       PropertyDescriptor propertyDescriptor[] = { displayDate, displayTime, dateStyle, timeStyle,
  83.                                                   alignment, locale, background, foreground, font,
  84.                                                   bevelInner, bevelOuter, margins, clockEnabled };
  85.       return propertyDescriptor;
  86.     } catch (Exception ex) {
  87.       System.err.println("unexpected exeption: " + ex);
  88.       return null;
  89.     }
  90.   }
  91.  
  92.   public EventSetDescriptor[] getEventSetDescriptors() {
  93.     EventSetDescriptor[] eventDescriptor = new EventSetDescriptor[0];
  94.     return eventDescriptor;
  95.   }
  96.  
  97.   public BeanDescriptor getBeanDescriptor() {
  98.     return new BeanDescriptor(InternationalClock.class);
  99.   }
  100.  
  101.   public Image getIcon(int iconKind) {
  102.     if (iconKind == BeanInfo.ICON_COLOR_32x32) {
  103.       return loadImage("resources/InternationalClockIconColor32.gif");
  104.     }
  105.     return null;
  106.   }
  107.     
  108. }
  109.