blow
blow

Reputation: 13209

Java - Add custom event Listener to a eventSet in beanInfo with Netbeans

i have a custom bean and a custom eventListener, i need to show my event Listener in the events tab of my bean.

I think the solution is to add my event Listener to a beaninfo(i create it with netbeans, so it is auto-generated). There is a "wizard-way" to do this, or i have to hand-write my beaninfo?

Thanks.

Upvotes: 1

Views: 2750

Answers (1)

blow
blow

Reputation: 13209

The solution is to have all methods for listener management, so Netbeans can recognize it and put it inside beaninfo.

For example, if you have a custom listener called ActionDataListener, you have to add this methods:

    public void addActionDataListener(ActionDataListener listener) {
        actionDataListeners.add(listener);
    }

    public void removeActionDataListener(ActionDataListener listener) {
        actionDataListeners.remove(listener);
    }

    public ActionDataListener[] getActionDataListeners() {
        return actionDataListeners.toArray(new ActionDataListener[0]);
    }

Upvotes: 1

Related Questions