home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 November / Chip_1998-11_cd.bin / tema / Cafe / main.bin / SimpleBeanInfo.java < prev    next >
Text File  |  1997-05-20  |  4KB  |  125 lines

  1. /*
  2.  * @(#)SimpleBeanInfo.java    1.17 97/01/30  
  3.  * 
  4.  * Copyright (c) 1996 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  * CopyrightVersion bdk_beta
  20.  * 
  21.  */
  22.  
  23. package java.beans;
  24.  
  25. /**
  26.  * This is a support class to make it easier for people to provide
  27.  * BeanInfo classes.
  28.  * <p>
  29.  * It defaults to providing "noop" information, and can be selectively
  30.  * overriden to provide more explicit information on chosen topics.
  31.  * When the introspector sees the "noop" values, it will apply low
  32.  * level introspection and design patterns to automatically analyze
  33.  * the target bean.
  34.  */
  35.  
  36. public class SimpleBeanInfo implements BeanInfo {
  37.  
  38.     /**
  39.      * Deny knowledge about the class and customizer of the bean.
  40.      * You can override this if you wish to provide explicit info.
  41.      */
  42.     public BeanDescriptor getBeanDescriptor() {
  43.     return null;
  44.     }
  45.  
  46.     /**
  47.      * Deny knowledge of properties. You can override this
  48.      * if you wish to provide explicit property info.
  49.      */
  50.     public PropertyDescriptor[] getPropertyDescriptors() {
  51.     return null;
  52.     }
  53.  
  54.     /**
  55.      * Deny knowledge of a default property. You can override this
  56.      * if you wish to define a default property for the bean.
  57.      */
  58.     public int getDefaultPropertyIndex() {
  59.     return -1;
  60.     }
  61.  
  62.     /**
  63.      * Deny knowledge of event sets. You can override this
  64.      * if you wish to provide explicit event set info.
  65.      */
  66.     public EventSetDescriptor[] getEventSetDescriptors() {
  67.     return null;
  68.     }
  69.  
  70.     /**
  71.      * Deny knowledge of a default event. You can override this
  72.      * if you wish to define a default event for the bean.
  73.      */
  74.     public int getDefaultEventIndex() {
  75.     return -1;
  76.     }
  77.  
  78.     /**
  79.      * Deny knowledge of methods. You can override this
  80.      * if you wish to provide explicit method info.
  81.      */
  82.     public MethodDescriptor[] getMethodDescriptors() {
  83.     return null;
  84.     }
  85.  
  86.     /**
  87.      * Claim there are no other relevant BeanInfo objects.  You
  88.      * may override this if you want to (for example) return a
  89.      * BeanInfo for a base class.
  90.      */
  91.     public BeanInfo[] getAdditionalBeanInfo() {
  92.     return null;
  93.     }
  94.  
  95.     /**
  96.      * Claim there are no icons available.  You can override
  97.      * this if you want to provide icons for your bean.
  98.      */
  99.     public java.awt.Image getIcon(int iconKind) {
  100.     return null;
  101.     }
  102.  
  103.     /**
  104.      * This is a utility method to help in loading icon images.
  105.      * It takes the name of a resource file associated with the
  106.      * current object's class file and loads an image object
  107.      * from that file.  Typically images will be GIFs.
  108.      * <p>
  109.      * @param resourceName  A pathname relative to the directory
  110.      *        holding the class file of the current class.  For example,
  111.      *        "wombat.gif".
  112.      * @return  an image object.  May be null if the load failed.
  113.      */
  114.     public java.awt.Image loadImage(String resourceName) {
  115.     try {
  116.         java.net.URL url = getClass().getResource(resourceName);
  117.         java.awt.Toolkit tk = java.awt.Toolkit.getDefaultToolkit();
  118.         return tk.createImage((java.awt.image.ImageProducer) url.getContent());
  119.     } catch (Exception ex) {
  120.         return null;
  121.     }
  122.     }
  123.  
  124. }
  125.