Enrico Scantamburlo: My Five Favorite NetBeans IDE Features!
Join the DZone community and get the full member experience.Join For Free
i am enrico scantamburlo, i am been working with the netbeans ide since netbeans ide 5.5. currently employed at streamsim where we are developing studiosl , an application based on the netbeans platform.
what are your five favorite netbeans ide features?
1. ctrl+shift+up/down and alt+shift+up/down and code templates
these are my favorite key shortcuts! when i'm coding, it is very common for me to duplicate a line or move some group of lines upward or downward. the common way to do it is use ctrl+c/x, move the cursor to the new position and press ctrl+p. in netbeans this can be done automatically using ctrl/alt+shift+up/down. it saves a lot of time especially if you want to duplicate lines quickly.
furthermore, there are a lot of code templates to save time typing; some of my favorites are:
- psf+tab that is expanded to “private static final”
- log+tab that is expanded to a log statement
- sout+tab that is expanded to system.out.println(“”)
sb+tab to create a stringbuilder
it is also possible to write custom templates for the statements you use the most.
2. dependency automatic search
if you are working on a modular application that is based on netbeans, it happens frequently that you have to use an api that is declared in another module. recently a hint has been added to ant-based netbeans module projects to search if a class or an interface is available in some module provided by the suite, in the same way you are asked to fix a missing include.
this feature is also available for any maven project, if a class cannot be found in the current classpath it will be searched in the maven repository and added to the pom as a dependency.
3. rectangular selection
while writing unit tests or editing some numerical table, it happened to me several times to have to modify multiple lines at once. in netbeans there is a tool for that and it is located in the editor toolbar.
when the button is pressed, the user can select a rectangular section of the document. if you write on a rectangular selection the text will appear on all the lines, the same behavior occurs when you copy and paste text.
4. java 7 and refactoring
we recently moved to java 7 from java 6 and now we can use the new syntax sugar that java 7 offers. with netbeans this is very easy, i can click on the hint next to the code to change it automatically...
...or i can right click on the projects window and select “refactor/inspect and transform.../convert to jdk7” on a file, package or module and it will update all the code to the new version.
of course, this is available also for migration to java 8. with the same procedure, it is possible to enhance the code in many other ways, like adding the “override” annotation automatically.
5. automatic exception handling
in the (rare) case of an exception in the ide, netbeans automatically catches it and asks the user to report it. i found it very convenient for several reasons: first of all, it automatically attaches all the environmental information and the ide log, so i do not have to do it myself. in the second place, the infrastructure is reusable and we use it in streamsim studiosl to track bugs from our clients. moreover, when a new version is released, you find a mail in your inbox telling you which of the bugs you sent have been fixed.
from inside the ide, it is possible to see all the reports you have sent:
do you also want to share your favorite netbeans features with the world? write to netbeans dot webmaster at gmail dot com.
Opinions expressed by DZone contributors are their own.