Over a million developers have joined DZone.

Top 10 New Java Features in NetBeans IDE 6.5 (Part 1)

DZone 's Guide to

Top 10 New Java Features in NetBeans IDE 6.5 (Part 1)

· Java Zone ·
Free Resource

Though the latest release of NetBeans IDE focuses very heavily on dynamic languages, and PHP in particular, there are many new and enhanced features that should appeal very specifically to Java programmers. The complete feature list for the entire release of NetBeans IDE 6.5 is really long and colorful, but let's focus specifically on 10 of the Java-related highlights. Let's begin by putting on a Java programmer's hat and ask the question: "Which, of the many cool new things, would be particularly appealing to a Java programmer? And why should a Java programmer now consider NetBeans IDE 6.5 above its competitors?"

That immediately cuts out a lot of the dynamic language stuff (i.e., throw the cool Ruby, Python, and PHP things out the window), as well as the things that relate to using the IDE in some special way. Just bare bones Java stuff is then left. And the highlights of these are, in my opinion, the following, in order of significance:

  1. Performance Improvements. If there is one area that every Java programmer (indeed, any programmer at all) is interested in, it is performance of their IDE. Discussions on this theme rage all over the web—the IDE that, despite its growing feature set, continues to be (and enhances the extent to which it is) performant is the one where most programmers will flock to. More so than any other (assuming the feature set is competitive), this is the distinguishing feature between IDEs, if the difference between them on this point is significant enough. Even more so than before, NetBeans IDE 6.5 focuses on this aspect. Since several releases, a performance team exists within the NetBeans engineering group (led by Jaroslav Tulach, one of the founders of the project who, more than anyone else, knows where to tweak and tune small things to big effect), focused very specifically on these aspects: ensuring that the startup time of modules in the system is acceptable, enhancing the hooks by which objects are created, attempting to ensure that this is done as lazily as possible, etc.

    Performance covers many areas, from start up time, to editor responsiveness (i.e., if you need to wait for the code completion box to appear, you have a performance problem), to the speed at which dialogs such as the Options window appear. Also, as applications increase in size, to a point where they become extremely large with many thousands of files, there is an inevitable performance impact: the trick is to keep this impact as limited as possible. (A related problem is reproducing the related issue reports: if your performance problem occurs when you have a freshly opened project consisting of hundreds of thousands of files, there's a chance that your problem will be hard to reproduce, and a related chance that your application isn't optimally designed to begin with).

    One way in which performance hits are kept to a minimum is that, for the first time, starting from NetBeans IDE 6.5, a node within a tree hierarchy is created only when it is needed (i.e., as the user scrolls down the Projects window, for example) and not before that point. More generally, modularity relates to this too, in that you should install the IDE distribution that you need: if you are "only" a Java desktop developer, for example, you should not get the NetBeans distribution that includes web features and mobile development features. These additional features are provided by additional modules, which would need to be started up superfluously, extending your startup time while giving you no features that are of use to you.

    In short, it is hard to imagine how seriously issues of performance are taken by the NetBeans team. Is that new in 6.5? No, but several of the API enhancements that have been done for 6.5 have been done specifically for this very particular purpose, i.e., to ensure that the IDE continues to improve its performance while at the same time acquiring new features. These two requirements are, in the absence of this specific focus, mutually exclusive. In even shorter, a significant performance improvement should be noticed in 6.5, from start up time, to editor responsiveness, to everything you do in the IDE, though a key element is choosing the right distribution for your needs.

  2. Compile & Deploy on Save. One of the key features that has distinguished NetBeans by its absence, 6.5 now includes. Better than describing it in words is to show it in action. Watch the video below for details.

  3. Groovy. More than any other scripting language, Groovy lends itself to handling the heavy lifting of traditional cumbersome Java tasks, without requiring you to make a huge mental shift to start using it. The ease with which this is possible is quite amazing:

    (In other words, just code your Groovy class in Groovy and then, in your Java class, simply pretend the Groovy class is a Java class, which is what it will become anyway when you compile it, and call its methods as you would do with a Java class.) Yes, the introduction of Groovy is a feature enhancement for Java programmers. Here's one of many simple examples to that effect:

    Indeed, don't take my word for it, but see, for example, some of the comments at the end of this NetBeans IDE 6.5 release announcement and absorb the enthusiasm with which this feature in 6.5 is being welcomed.

  4. Java Editor Enhancements. An area where NetBeans IDE has consistently improved, while continuing to lag over its peers, is the Java editor, in terms of its performance (see above) and, in particular, its range of refactorings. In fact, any presentation done by any NetBeans presenter (ever, I dare say) has been followed by the question/statement: "Yes, but IDE XYZ has more, better, and faster refactorings." In this sense, whether NetBeans IDE 6.5 equals another IDE in this regard is not as significant as whether it enhances significantly enough for the enhancements to be noticeable, since it always comes out with code-generation tools that are superior to its peers. If editor progress is consistent across releases, and there are significant other features (such as code-generating tools) being introduced at the same time, it is clear that a concerted attempt is being made to catch up and, even, improve on competitors' offerings.

    Here are a few indications that this is certainly the case in 6.5:

    • Code Completion. The jewel of any code editor is, I believe, together with the "hints/tips" feature (so wonderfully represented in IntelliJ), the code completion feature. Any enhancement in this area, after performance, is inevitably very fine grained, which is exactly the level at which code completion is most useful. One enhancement in this area to have made its way into NetBeans IDE 6.5, is CamelCase code completion:

      You can simply write the first letters of a word to get smart code completion. As shown above, "iL" expands to invokeLater. In addition, for the first time, code completion has been introduced into the SQL Editor, which is no trivial improvement for Java developers who need to work with databases (and what kind of developer doesn't?):

      (In the SQL Editor, there are a number of other significant improvements: SQL history, editable & sortable results, multiple tabs for different results, with several more in the planning for the next release.)

    • Creating Getter/Setter from Existing Variable. When you want to refactor a variable such that it acquires a getter/setter combination, these are all the options available in 6.5...

      ...compared to 6.1:

    • Call Hierarchy Analyzer. Want to know how a method relates to another method? For example, which code in your application is calling the current method? And which code is being called by it? Nothing simpler in 6.5 than right-clicking on the line and then choosing "Call Hierarchy". A new window will open, with several buttons for refreshing the view, either with callers or callees, and setting filtering options: 

    • Formatting Refactoring. Another area where NetBeans IDE has had room for improvement is that of formatting. Formatting options have always been settable IDE-wide, never project-wide, unlike (for the first time) in 6.5:

      I.e., the entire tab that you see above wasn't there before 6.5.

    • Javadoc Refactoring. For another example of editor improvements, let's look at this piece of code:
      public class HelloWorld {

      * @param name
      public String SayHello(String name) {
      return "Hello" + name;


      Now, I decide that the age needs to be passed in to the method, so I add a new parameter:

      public class HelloWorld {

      * @param name
      public String SayHello(String name, int age) {
      return "Hello " + name + ". You're " + age + " years old.";


      And so, in this situation, you can now (from 6.5 onwards) right-click on a node (e.g., on a Java package or class in the Projects window) and choose Tools | Analyze Javadoc. In the above code, the IDE would then show you the following window:

      As you can see, this feature lets you update your Javadoc very easily. Place checkmarks by the Javadoc fixes you'd like the IDE to implement for you, as you can see below:

      Then click "Fix Selected" and some simple Javadoc stubs are created for you:

    • Java Editor Related API Changes. Some of the (many) API changes that have taken place in the 6.5 timeframe are very relevant to the Java editor. For example, the small code generator popup that appears when you press Alt-Insert can now be extended. This means that you can add your own entries there which, as a result, will let you generate additional/custom code snippets into the Java (or any other) editor. Previously, the code generator popup was only available in the Java editor, while now it can be added to any editor at all, i.e., either one of the IDE's default editors (such as the HTML editor, as shown here, or the JavaFX editor, as shown here) or a custom editor created externally.

      Another example is that the Palette API has been enhanced so that, if a palette makes use of this enhancement, you are now able to drag snippets of code from the editor into the palette (as well as the other way round, of course). That's handy for storing your frequently used code snippets for later reuse. The API in question has been applied to the palette for HTML files only, in 6.5, but this will probably be extended to all the other palettes too (and you can very simply apply it to your own custom palettes that you might already have).

  5. Matisse GUI Builder Enhancements. The Matise GUI Builder is not everyone's best friend, but should definitely be more so now that 6.5 is out. Some pretty sophisticated changes have been made, partly to simplyify working with the GUI Builder's user interface and partly to improve the generated code:

    • Brand New Swing Component Editors. Working with JTree models has never been much fun but now, dare I say it, it's very close to being that, with this brand new JTree model editor:


      In other words, the above is not an enhancement, but a completely new editor, with a free form space, as you can see above, where you can simply type text and, based on the indentations, the JTree model is constructed by the editor.

      A similar thing has been done for the JComboBox and the JList. Here's the JList Editor, first in 6.1, and then the new free form 6.5 version:

    • Nimbus Previewer. When designing your layout in the Matisse GUI Builder, you can very easily preview your current state in the new Nimbus look & feel:

    • Many More GUI Builder Customizations. Compare these two screenshots, the first from 6.1 and the second from 6.5, to see how much has changed in terms of what can be configured globally:

      Here my favorite enhancement is "Generate Fully Qualified Names of Classes" which, when deselected, ensures that the import statements get added to the top of the class while the code statements themselves are as short and compact as possible. Also useful for refactoring, because when the class you are referencing moves to a different package, you need only update your import statements, which are all neatly at the top, rather than stuck within the blue blocks, which are considerably less easy to edit.

And that is the end of part 1. In part 2, we will look at 5 other features in NetBeans IDE 6.5 specifically targeted at Java developers, in particular at tools such as the Debugger and Profiler, tools that any user of NetBeans IDE should be able to get familiar with to great effect. Until then, have fun with NetBeans and make sure to pass on to the NetBeans team any comments good/bad/ugly that you might have.




Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}