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.
When I was using 5.5beta I created several panels where I reused an event handler for multiple components. This does not work in the released 5.5. For example, I have 3 fields that cannot be zero length and the value must be numeric. For the first one, I went to Properties > Events > focusLost and created a handler (something like "textFieldFocusLost") and added some code that would highlight the field as being invalid. For the other 2 fields, when I clicked the focusLost event button the "Handlers for FocusLostEvent" dialog displayed the previously defined handler and let me select it. As a result, I have a form with 3 fields with code in the protected block that looks like this: fieldName.addFocusListener(new java.awt.event.FocusAdapter() { public void focusLost(java.awt.event.FocusEvent evt) { textFieldFocusLost(evt); } }; All 3 fields each have an anonymous inner class derived from FocusAdapter registered for FocusLostEvent and all 3 adapters call textFieldFocusLost() to do the work. In the final 5.5 release the "Handlers for xxx" dialog never shows me an existing handler. I've resorted to defining my own method, then generating multiple event handler stubs, but this is messy and adds an extra, unnecessary function call.
This is a misunderstanding the Handlers for xxx dialog shows just the handlers assigned to the selected component. So, it is correct that the dialog is empty for a newly added component. If you want to share the same handler among more components, press Add button and specify the name of existing handler - for example 'textFieldFocusLost' in your case.
Ok, that makes sense, it's showing what *is* assigned, not what *can* be assigned. Would it be possible to add a "Select" button to the "Add", "Rename", "Remove" already present in the dialog? It would present the developer with a list of methods having the correct signature that can be assigned to this event. It would make it a lot easier than having to enter the name. In complex forms you can wind up with a lot of these and picking from a list would be easier. Especially in light of the fact that when you are making the choice you are in the Design view and cannot simply browse the code for the correct name. Should I reopen this as an enhancement request or enter a new enh req?
I agree that besides possibility to enter the name of a new handler it would be nice to be able to select from the existing handlers. Please, fill a separate issue (enhancement) for that, thanks.
Ok, done enhancement request added as issue# 104134