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.
Hi, i am experiencing the following problem: When i right-click on a, for example, JButton inside the GUI designer and i choose "Events->(for example)->"Action"->"actionPerformed" i am prompted inside the code, with the handler for the event already declared. The problem is that i would like to choose custom names for events handlers methods, or choose already existing methods. If i try to get inside the "Properties" of the JButton, in the "Events" tab, if i try to type the name of an already existing method to handle the event, netbeans will create another empty method with the same name, ignoring the already existing one. (and that will of course result in an error). The only way to achieve what i'm looking for, is apparently to write the ActionListener by myself, with the "Customize code" option. But the problem of this solution is that netbeans will not recognize it, and if i will right-click on the component, in the "Events" section, no event will be marked as handled (and this function is very useful to jump directly to the handler). I hope i managed to clearly explain my problem. Thanks in advance for any help! Nite.
Reassigning to "form" for evaluation...
The GUI builder currently does not allow to use a custom method as an event handler directly. It is required the event handler method is generated by the GUI builder as a guarded code (for consistency - because the call is also in guarded code, so it can't be deleted by the user). Perhaps we could allow using user methods directly. We have similar enhancements in issue 25010 and issue 104134. There is a possible workaround, slightly less comfortable but fully working: let the GUI builder generate its event handler and then call your method from it.