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.
Besides calling voids in anonymous event listeners, let the user decide whether to place the code inside or outside the event listener method. For instance: foo.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ blahBlahBlah(); } }); ... public void blahBlahBlah(){ //whatever } Could be: foo.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ //Add the whatever code here } });
Thank you for your report. If you don't like default anonymous event listener style inside generated method initComponents(), you can change it. Open Properties view of root form node and change "Listener Generation Style". Back to your example, we will not allow users to edit initComponents() method body directly, this method is very important for gui designer and content of this method is regenerated very frequently. Your code is situated outside of this method, it can contains a lot of lines and it could be very dangerous and very slow to put large amount of your code somewhere inside initComponents() and regenerated all that stuff again and again. So I think, that we will not change our blahBlahBlah() method pattern. ;)