This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Is it possible that more than one listener will be attached to a InplaceEditor? I guess it is not, as it is guaranteed that only one InplaceEditor is open at a time. If this is true, I suggest to change the signature of addActionListener to throw TooManyListeners exception. Then instead of writing a complicated support for adding listeners the implementors could choose to have just one field: private ActionListener l; public void addActionListener (l) { if (this.l != null) throw new TooManyListenersEx(); this.l = l; } which is simpler and easier.
No it can't, that's a checked exception.
Yes, it is checked exception, but I am not sure why that would clasify this issue as invalid. So once more. Please consider simplifying the life of InplaceEditor writers by declaring void InplaceEditor.addActionListener (ActionListener l) throws TooManyListenersException which properly expresses your desire to attach just one listener to each InplaceEditor and simplifies the life of writers in both cases: 1. if they inherit after JPanel (that does not have addActionListener method), they can simply write the code as described above with one field variable. 2. if they inherit from JTextField (has the addActionListener method and does not throw the exception) they do not need to do anything and it will still continue to work.
Closing - not a terribly compelling argument, IMO. Compound components here are really the exception, not the rule, so 90% of the time it's fine. Also, there is no guarantee that a component, or worse (and more likely) a look and feel will not try to add its own action listener to the component, causing the exception to be thrown - people may see the throws argument and think they need to police it. There are equally effective ways to police listeners, such as clearing the listener list when clear() is called on the InplaceEditor. Simpler and safer to leave it as is.
verifying.