⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jxcollapsiblepanebeaninfo.java

📁 java实现浏览器等本地桌面的功能
💻 JAVA
字号:
/* * $Id: JXCollapsiblePaneBeanInfo.java,v 1.3 2005/10/10 18:01:49 rbair Exp $ * * Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle, * Santa Clara, California 95054, U.S.A. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. *  * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU * Lesser General Public License for more details. *  * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */package org.jdesktop.swingx;import java.awt.Image;import java.beans.BeanDescriptor;import java.beans.BeanInfo;import java.beans.IntrospectionException;import java.beans.Introspector;import java.beans.MethodDescriptor;import java.beans.PropertyDescriptor;import java.beans.SimpleBeanInfo;import java.lang.reflect.Method;import java.util.Vector;/** * BeanInfo class for JXCollapsiblePane. */public class JXCollapsiblePaneBeanInfo extends SimpleBeanInfo{   /** Description of the Field */   protected BeanDescriptor bd = new BeanDescriptor(JXCollapsiblePane.class);   /** Description of the Field */   protected Image iconMono16;   /** Description of the Field */   protected Image iconColor16;   /** Description of the Field */   protected Image iconMono32;   /** Description of the Field */   protected Image iconColor32;   /** Constructor for the JXCollapsiblePaneBeanInfo object */   public JXCollapsiblePaneBeanInfo() throws java.beans.IntrospectionException   {   	// setup bean descriptor in constructor.        bd.setName("JXCollapsiblePane");       bd.setShortDescription("A pane which hides its content with an animation.");       bd.setValue("isContainer",Boolean.TRUE);       bd.setValue("containerDelegate","getContentPane");       BeanInfo info = Introspector.getBeanInfo(getBeanDescriptor().getBeanClass().getSuperclass());       String order = info.getBeanDescriptor().getValue("propertyorder") == null ? "" : (String) info.getBeanDescriptor().getValue("propertyorder");       PropertyDescriptor[] pd = getPropertyDescriptors();       for (int i = 0; i != pd.length; i++)       {          if (order.indexOf(pd[i].getName()) == -1)          {             order = order + (order.length() == 0 ? "" : ":") + pd[i].getName();          }       }       getBeanDescriptor().setValue("propertyorder", order);   }   /**    * Gets the additionalBeanInfo    *    * @return   The additionalBeanInfo value    */   public BeanInfo[] getAdditionalBeanInfo()   {      Vector bi = new Vector();      BeanInfo[] biarr = null;      try      {         for (Class cl = JXCollapsiblePane.class.getSuperclass(); !cl.equals(java.awt.Component.class.getSuperclass()); cl = cl.getSuperclass()) {            bi.addElement(Introspector.getBeanInfo(cl));         }         biarr = new BeanInfo[bi.size()];         bi.copyInto(biarr);      }      catch (Exception e)      {         // Ignore it      }      return biarr;   }   /**    * Gets the beanDescriptor    *    * @return   The beanDescriptor value    */   public BeanDescriptor getBeanDescriptor()   {      return bd;   }   /**    * Gets the defaultPropertyIndex    *    * @return   The defaultPropertyIndex value    */   public int getDefaultPropertyIndex()   {      String defName = "";      if (defName.equals(""))      {         return -1;      }      PropertyDescriptor[] pd = getPropertyDescriptors();      for (int i = 0; i < pd.length; i++)      {         if (pd[i].getName().equals(defName))         {            return i;         }      }      return -1;   }   /**    * Gets the icon    *    * @param type  Description of the Parameter    * @return      The icon value    */   public Image getIcon(int type)   {      if (type == BeanInfo.ICON_COLOR_16x16)      {         return iconColor16;      }      if (type == BeanInfo.ICON_MONO_16x16)      {         return iconMono16;      }      if (type == BeanInfo.ICON_COLOR_32x32)      {         return iconColor32;      }      if (type == BeanInfo.ICON_MONO_32x32)      {         return iconMono32;      }      return null;   }   /**    * Gets the Property Descriptors    *    * @return   The propertyDescriptors value    */   public PropertyDescriptor[] getPropertyDescriptors()    {      try      {         Vector descriptors = new Vector();         PropertyDescriptor descriptor = null;         try         {            descriptor = new PropertyDescriptor("animated", JXCollapsiblePane.class);         }         catch (IntrospectionException e)         {            descriptor = new PropertyDescriptor("animated", JXCollapsiblePane.class, "getAnimated", null);         }         descriptor.setPreferred(true);         descriptor.setBound(true);         descriptors.add(descriptor);         try         {            descriptor = new PropertyDescriptor("collapsed", JXCollapsiblePane.class);         }         catch (IntrospectionException e)         {            descriptor = new PropertyDescriptor("collapsed", JXCollapsiblePane.class, "getCollapsed", null);         }         descriptor.setPreferred(true);         descriptor.setBound(true);         descriptors.add(descriptor);         return (PropertyDescriptor[]) descriptors.toArray(new PropertyDescriptor[descriptors.size()]);      }      catch (Exception e)      {        // Ignored      }      return null;   }   /**    * Gets the methodDescriptors attribute ...    *    * @return   The methodDescriptors value    */   public MethodDescriptor[] getMethodDescriptors() {      Vector descriptors = new Vector();      MethodDescriptor descriptor = null;      Method[] m;      Method method;      try {         m = Class.forName("org.jdesktop.swingx.JXCollapsiblePane").getMethods();      } catch (ClassNotFoundException e) {         return new MethodDescriptor[0];      }      return (MethodDescriptor[]) descriptors.toArray(new MethodDescriptor[descriptors.size()]);   }}

⌨️ 快捷键说明

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