Auto create constructor body and fields in Netbeans based on signature

You can write the empty constructor with the required signature. Then set the cursor next to a parameter and press Alt+ENTER.

NetBeans will ask to create a new field. Press ENTER and NetBeans will write the code for you.

I think you have to do it for each parameter separately, but I'm not sure.

Generally, Alt+ENTER in NetBeans is similar to Ctrl+1 in Eclipse, also at other places.


from: https://coderwall.com/p/oyanzg

Just point the cursor at the point where you want the generated code to appear, and press Alt + Insert (or select Source -> Insert Code). The following menu will appear, where you can choose to generate whatever you want:

enter image description here

Tags:

Java

Netbeans