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.
Hello, and here is my suggestion: Netbeans uses the initComponents-Method to init all the designed Components: Im shure all of you know that... //---------------------------------------------- applicationConstructor{ init_components(); .. } // Dont touch this... initComponents(){ myBean bean = new myBean(); } private myBean bean; // property generated by Netbeans //---------------------------------------------- But I prefer the following designpattern to accomplish that: private getMyBean(){ if(bean==null){ bean = new myBean(); // Do lot of additional initial stuff // reachable by a Code-Generation Entry. bean.setImportantProperty(getStuff()); } return bean; } Initcomponents Method should now look like that: init_components(){ myBean bean = getMyBean(); // old Look getMyBean(); // new Look // better is direct use: getContentPane().add(getMyBean(),...); } The enhancement is crystal clear: Whenever i get my Bean with the getter Method, i earn a instance of it. This becomes important when you have a lot of stuff with dependencies (so i have very often). I would love Netbeans more, when it would create Methods like above described. (I know i could do all this by hand but, my Fingers are wound of typing such stuff. Your judgement please, would this also be helpfull for you ???? carsten
This could be nice. Some comments: The getters probably should not be created for all components automatically - this could be configurable (for all in Options, and for individuals - similarly to how e.g. variables modifiers can be specified). There's a problem with guarded code. We'd need the get method to be guarded (all code which is to be regenerated must be guarded) with exception of some code in the middle left for the user modification. But I'm affraid this is not possible to achieve now with current guarded sections in NetBeans (whole method can be guarded, or just the method boundaries, but not an arbitrary number of lines from the beginning or end of the method).
Set target milestone to TBD
This is actually the only thing from Eclipse's VE that I liked more than NetBeans. It's very useful from a refactoring point of view to have separate methods returning configured graphic components; a single, huge initComponents() does not lend itself to much fancy manipulations. I believe an initial implementation of fully guarded methods is the right step: customized code would be inserted via the Code section of the Properties window for each component. Thank you for your attention.
See also issue 37680.