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.

Bug 152771

Summary: Add support for anonymous event listeners without voids
Product: guibuilder Reporter: alexandros <alexandros>
Component: CodeAssignee: issues@guibuilder <issues>
Status: RESOLVED WONTFIX    
Severity: blocker    
Priority: P4    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description alexandros 2008-11-08 11:22:11 UTC
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
    }
});
Comment 1 Jiri Vagner 2008-11-10 09:01:23 UTC
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. ;)