You can't by directly editing the code. Netbeans uses a seperate file for code generation (.form, XML). This is a one-way process, Netbeans is not capable of parsing source code for editing in it's visual editor... This is a catastrophe for interoperability (use Netbeans only for GUI editing or changes will be overwritten when you use it next time; or don't use the Netbeans GUI builder at all); but you can still influence most of the code generated. Changes will be stored in the .form-XML and show up in the generated code.
Just select the component and select the "Code" button in the properties view (the four buttons there are really tabs which show different pages in this view). If you set "Custom Creation Code" to a factory method then you can outsource the code editing to the code editor which is much more convinient.
subject: how to change the generated code by IDE (netbeans)