jdatepickerbeaninfo.java

来自「OpenSwing的经典示例」· Java 代码 · 共 63 行

JAVA
63
字号
package com.sunking.swing;import java.beans.*;/** * <p>Title: OpenSwing</p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2004</p> * <p>Company: </p> * @author <a href="mailto:sunkingxie@hotmail.com">SunKing</a> * @version 1.0 */public class JDatePickerBeanInfo extends SimpleBeanInfo {  Class beanClass = JDatePicker.class;  String iconColor16x16Filename = "TEMP_Color16.gif";  String iconColor32x32Filename = "TEMP_Color32.gif";  String iconMono16x16Filename = "TEMP_Color16.gif";  String iconMono32x32Filename = "TEMP_Color32.gif";  public JDatePickerBeanInfo() {  }  public PropertyDescriptor[] getPropertyDescriptors() {    try {      PropertyDescriptor _selectedDate = new PropertyDescriptor("selectedDate", beanClass, "getSelectedDate", "setSelectedDate");      _selectedDate.setDisplayName("Selecte Date");      _selectedDate.setShortDescription("Selecte Date");      PropertyDescriptor _selectedItem = new PropertyDescriptor("selectedItem", beanClass, null, "setSelectedItem");      PropertyDescriptor[] pds = new PropertyDescriptor[] {        _selectedDate,        _selectedItem};      return pds;    }    catch(IntrospectionException ex) {      ex.printStackTrace();      return null;    }  }  public java.awt.Image getIcon(int iconKind) {    switch (iconKind) {      case BeanInfo.ICON_COLOR_16x16:        return iconColor16x16Filename != null ? loadImage(iconColor16x16Filename) : null;      case BeanInfo.ICON_COLOR_32x32:        return iconColor32x32Filename != null ? loadImage(iconColor32x32Filename) : null;      case BeanInfo.ICON_MONO_16x16:        return iconMono16x16Filename != null ? loadImage(iconMono16x16Filename) : null;      case BeanInfo.ICON_MONO_32x32:        return iconMono32x32Filename != null ? loadImage(iconMono32x32Filename) : null;    }    return null;  }  public BeanInfo[] getAdditionalBeanInfo() {    Class superclass = beanClass.getSuperclass();    try {      BeanInfo superBeanInfo = Introspector.getBeanInfo(superclass);      return new BeanInfo[] { superBeanInfo };    }    catch(IntrospectionException ex) {      ex.printStackTrace();      return null;    }  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?