Channels ▼
RSS

Open Source

NetBeans 6.0: A First Look


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.

[Click image to view at full size]
Figure 3: Enhanced syntax highlighting includes distinct highlighting of static variables (italics), deprecated code (strikethroughs), and much more.

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.
  • Easy conversion of highlighted code (i.e., easily convert a highlighted String literal to a variable or constant).
  • Instant code refactoring.
  • 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.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

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.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.
 

Video