Loading...

June 18, 2008

Shortcut for quick code insertion in NetBeans

Creating a getter or setter method, overriding a method of a superclass, it is all stuff we do quite frequently when developing Java code. In NetBeans we have a shortcut to do this: Alt+Insert, or right-click in the source code and select Insert code...:

The options we have is dependent on the content of the Java source file. For example if we don't have any properties in our Java class, like in the previous screenshot, then we don't have an option to create a getter or setter. But if we do have a property, the option to create a getter or setter is there. The following screenshot shows we have more options, because of the property name in the source code: