BeanInfo get info from Bean

Posted on 2007-11-15
Last Modified: 2012-06-27
I'm working on a java bean with a beanInfo.
I've pasted my two classes below.
ParentNode contains the info, and ParentNodeBean contains display information.
Now I'd like to change my BeanDescriptor.DisplayName to ParentNode.getMyName
But I can not figure out how?

public class ParentNodeBeanInfo extends SimpleBeanInfo {

    private final static Class parentNode = ParentNode.class;


    public Image getIcon(int type) {

       return Utilities.loadImage("/nodeTest/suite.png");





  public BeanDescriptor getBeanDescriptor() {

      BeanDescriptor beanDescriptor = new BeanDescriptor(parentNode);

    beanDescriptor.setDisplayName("Test name");

  //  bd.setDisplayName(parentNode.getTestName()); //<--this is it

    return beanDescriptor;



public class ParentNode implements Serializable {

    private String myName;

    private String testValue;

    private PropertyChangeSupport propertySupport;

    public ParentNode() {

        propertySupport = new PropertyChangeSupport(this);


    public String getMyName() {

        return myName;


    public void setMyName(String myName) {

        String old = this.myName;

        this.myName = myName;

        propertySupport.firePropertyChange("myName", old, this.myName);


    public String getTestValue() {

        return testValue;


    public void setTestValue(String testValue) {

        this.testValue = testValue;


    public void addPropertyChangeListener(PropertyChangeListener listener) {



    public void removePropertyChangeListener(PropertyChangeListener listener) {





    public String toString() {

        return "getMyName:" + this.getMyName();


Open in new window

Question by:kristian_gr
  • 2

Expert Comment

ID: 20288161
But the BeanDescriptor.DisplayName display a gendral information about the bean its not for representing the bean values

Accepted Solution

deeppra earned 500 total points
ID: 20288164
For more info

As explained earlier JBuilder discovers the properties, methods and events of a bean through introspection based on the JavaBeans API. If we want to provide more information about a bean, or want to refine the information available through introspection, we should define a class that implement the BeanInfo interface. A BeanInfo class typically subclasses the SimpleBeanInfo class, that is a no-op implementation of the BeanInfo interface. When we want to override only one or two methods in the BeanInfo interface it is easier to subclass SimpleBeanInfo then to implement BeanInfo directly. In order for JBuilder to be able to find the corresponding BeanInfo class to a bean, there is a naming convention to be followed: a BeanInfo class should have the same name as the bean with the string BeanInfo appended.

A BeanInfo class specifies a number of pieces of information for our bean:

    * Icons that represent the bean.
    * A BeanDescriptor object that contains a reference to a Customizer class for the bean. Customizers will be explained later.
    * A list of supported properties of the bean, along with a short description of these properties. These description will be used by JBuilder as tool tips in the Object Inspector.
    * Reference to property editor classes. Property editors will be explained later.
    * A list of methods supported by the bean, again with short descriptions of each one.

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
mapBully challenge 6 89
mapShare challenge 13 68
What is JNDI datasource in spring 1 38
wordcount challenge 11 76
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now