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 - Add support for anonymous event listeners without voids
Summary: Add support for anonymous event listeners without voids
Status: RESOLVED WONTFIX
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P4 blocker (vote)
Assignee: issues@guibuilder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-08 11:22 UTC by alexandros
Modified: 2008-11-10 09:01 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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. ;)