JVM Languages

NetBeans 6.0: A First Look

By Eric J. Bruno, January 24, 2008

NetBeans 6 is now in parity with Java Studio Creator in terms of Java UI and Ajax development

NetBeans Code Editor

Of all the feedback Sun received regarding previous versions of the NetBeans IDE, the most common theme was that the editor did not compare well to the competition. As a result, Sun listened to the feedback and completely re-implemented the editor framework for NetBeans 6.

This includes enhanced syntax highlighting, such as special support for static variables, and using a strike-through for deprecated code (see Figure 3). However, other features go way beyond this. For instance, NetBeans has enhanced programming language awareness, whether you're writing code in Java, C++, Ruby, Groovy, or any other language for which a NetBeans plug-in exists. In fact, NetBeans 6 includes full-featured editor functionality for all supported languages in addition to Java, such as C++, Ruby, and even JavaScript. No longer are scripting languages treated as second-class; developers will enjoy all of the same NetBeans features they're used to using with Java when working with script code.

Enhanced syntax parsing occurs as you peruse your code, such as when you move the cursor around. For instance, when the cursor is moved to a bracket, the opposing bracket is also highlighted (if it's in view). The same goes for variables; all occurrences of the variable will be highlighted when the cursor is moved within it. This is a feature that's been available in NetBeans and other IDEs for some time. However, it's been greatly expanded in NetBeans 6.

Other enhancements include inline renaming, where changing method or variable names, for instance, is a snap. Simply move the cursor to the method or variable name to be changed, hit CTRL-R (or Command-R for Mac OS X), and then type the new name. All instances of the renamed element will be updated throughput your project.

Adding new code is easier in many cases as well. For instance, code insertion and code completion both work in context to where your cursor is. Code insertion is used to generate entire code constructs, such as getter and setter methods, constructors, and so on. Code completion will complete something you've begun to type, such as a try..catch block, or the use of an object. The enhancements in NetBeans 6 give you more control over the code that's inserted or completed within your project. Other enhancements include:

Pop-up menus with code suggestions (i.e. a list of class member functions) appear more quickly.

More context awareness; i.e., suggested variable names are limited to subsets valid for the type expected in the code your cursor is at (such as method parameters, return type, and so on).

Most probable choices are placed at the top of the list in the pop-up menu.

As suggestions are made in-line, while typing, you can press Enter to accept, or simply continue typing to ignore.

In addition to a full-screen editor view (where all other panes and menus are temporarily removed from sight), you can now undock editor windows and move them independently from the main NetBeans window, and any other undocked editor windows (Figure 4). I find this feature particularly helpful; one that I've wanted for a while now. For instance, it's very convenient to keep editors open on one monitor while I debug an application with the main IDE window on a second monitor.

[Click image to view at full size]

Figure 4: Individual editor windows can be undocked from the main IDE window, and then moved and sized independently. This feature is very convenient when used with multiple-monitor configurations.

Although many of the enhancements and additional features in the NetBeans 6 editor may seem minor, together they add up to a much-improved coding experience. I've personally seen my productivity grow as a result. However, the enhancements in NetBeans 6 don't stop at the editor; let's explore other areas of significant improvement.

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task.
However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Video

This month's Dr. Dobb's Journal

This month,
Dr. Dobb's Journal is devoted to mobile programming. We introduce you to Apple's new Swift programming language, discuss the perils of being the third-most-popular mobile platform, revisit SQLite on Android
, and much more!