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.