How do I have my JavaBean display a custom icon when it is imported into a bean builder tool?

John Zukowski

You need to create a custom BeanInfo class for your bean with a public Image getIcon(int kind) method to return the necessary icon. Predefined types are BeanInfo.ICON_MONO_16x16, BeanInfo.ICON_MONO_32x32, BeanInfo.ICON_COLOR_16x16, or BeanInfo.ICON_COLOR_32x32.

Ignoring the icon check, the following demonstrates:

package com.jguru.beans;
import java.beans.*;

public class StickFigureBeanInfo
    extends SimpleBeanInfo {

  public java.awt.Image getIcon(int iconKind) {
    return loadImage("stickfigure.gif");
  }
}
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact