List of usage examples for java.beans BeanInfo getIcon
Image getIcon(int iconKind);
From source file:com.twinsoft.convertigo.beans.core.DatabaseObject.java
public Icon getIcon(int iconKind) { try {/*from ww w .j a v a2 s .c o m*/ BeanInfo bi = CachedIntrospector.getBeanInfo(getClass()); return new ImageIcon(bi.getIcon(iconKind)); } catch (Exception e) { Engine.logBeans.error("Unable to get the bean icon.", e); return null; } }
From source file:org.eclipse.wb.internal.rcp.databinding.model.beans.bindables.BeanSupport.java
/** * @return {@link Image} represented given bean class. *///from ww w .j a v a 2s. c om public Image getBeanImage(Class<?> beanClass, ObjectInfo javaInfo) throws Exception { // check java info if (javaInfo != null) { return null; } // prepare cached image Image beanImage = m_classToImage.get(beanClass); // check load image if (beanImage == null) { try { // load AWT image BeanInfo beanInfo = Introspector.getBeanInfo(beanClass); java.awt.Image awtBeanIcon = beanInfo.getIcon(BeanInfo.ICON_COLOR_16x16); if (awtBeanIcon == null) { // set default beanImage = Activator.getImage("javabean.gif"); } else { // convert to SWT image // FIXME: memory leak beanImage = ImageUtils.convertToSWT(awtBeanIcon); } } catch (Throwable e) { // set default beanImage = Activator.getImage("javabean.gif"); } m_classToImage.put(beanClass, beanImage); } return beanImage; }
From source file:org.eclipse.wb.internal.swing.databinding.model.beans.BeanSupport.java
/** * @return {@link Image} represented given bean class. *///w ww. j a v a2 s. c om public Image getBeanImage(Class<?> beanClass, JavaInfo javaInfo, boolean useDefault) throws Exception { // check java info if (javaInfo != null) { return null; } // prepare cached image Image beanImage = m_classToImage.get(beanClass); // check load image if (beanImage == null) { try { // load AWT image BeanInfo beanInfo = Introspector.getBeanInfo(beanClass); java.awt.Image awtBeanIcon = beanInfo.getIcon(BeanInfo.ICON_COLOR_16x16); if (awtBeanIcon == null) { // set default beanImage = useDefault ? Activator.getImage("javabean.gif") : null; } else { // convert to SWT image // FIXME: memory leak beanImage = SwingImageUtils.convertImage_AWT_to_SWT(awtBeanIcon); } } catch (Throwable e) { // set default beanImage = useDefault ? Activator.getImage("javabean.gif") : null; } m_classToImage.put(beanClass, beanImage); } return beanImage; }