NetBeans 7.1 – JavaFX 2.0 support, refactoring enhancements and great Maven 3 integration

NetBeans 7.1 has just been released. It is interesting how NetBeans continues to evolve – after many doubts were raised with regard to its future after the Oracle-Sun acquisition. Oracle maintains two IDEs – each with its own objectives. JDeveloper to support Fusion Middleware development, NetBeans to propel the Java platform and its associates (Groovy/Grails, Scala) with even more focus on standards and open source. NetBeans also support PHP and C++ code development – though I have no personal experience worth mentioning in these areas.

Image

NetBeans 7.1 is not a major overhaul – it is a continuation of the NetBeans IDE. However, it does add one major new area of functionality: JavaFX 2.0 support in addition to a number of valuable smaller enhancements. This article briefly touches upon a number of these enhancements – the one that most appealed to me. Download NetBeans 7.1 from http://netbeans.org/downloads/index.html.

An interesting webcast (10 minutes) about the 7.1 release can be found here: http://netbeans.org/kb/docs/ide/overview-screencast.html.

JavaFX 2.0 support

One of major evolutions on the Java platform is going on in the area of rich GUI development. JavaFX, first announced in 2007 (!) has taken some time to mature. After Oracle acquired Sun Microsystems, it made the fairly bold decision to discontinue FX Script, yet continue JavaFX in general. FX 2.0 has been positioned during JavaOne 2011 as the proposed successor AWT & Swing, to be complete integrated into the Java platform and made part of the JDK around or shortly after SE 8. The Summer of 2011 saw the preview release of FX 2.0, October the formal release as well as a preview for NetBeans 7.1 with FX support. Starting now, NetBeans 7.1 is done – with FX 2.0 support on board.

A new FX project is easily created in NetBeans – with all dependencies readily configured and an HelloWorld already implemented:

Image

FX applications can be run from within NetBeans as Browser based HTML + Applet, standalone Java Application or through Web Start (JNPL).

Additionally, NetBeans has this nice ‘samples’ option that allows one to quickly get a project going with running sample code. Many FX samples are included, demonstrating best FX coding practices and many nice FX features.

Image

For example the PuzzlePieces:

Image

Closely associated with FX development are various debugging features, especially the Visual Debugger. When running an FX application in debug mode, the camera icon allows us to take a screen-capture.

Image

Subsequently, we can inspect the code and structure of the FX scenegraph from that screen-capture.

Image

The snapshot is clickable and when a certain area is clicked upon, the associated FX code can be navigated to:

Image

That makes it really much easier to correct visual flaws and understand the flow through the FX components. Documentation on the Visual Debugger can be found at http://netbeans.org/kb/docs/java/debug-visual.html.

Java Coding and Refactoring

An area where NetBeans provides excellent support to developers obviously is Java programming. This 7.1 releases has some interesting new features to further enhance that ‘coding experience’. The most important one is probably the ‘batch refactoring’. With Batch Refactoring, specific refactoring actions can be performed on multiple objects in one go. As an example, NetBeans can help with the migration of Java code to Java 7, where migration means: making code benefit from enhancements available in Java 7. The available refactoring actions can be selected

Image

the artifacts to refactor can be selected (this can be the entire project) and the refactor action can be started. NetBeans presents the results for review before they are applied:

Image

and even more striking the use of a String argument in a switch statement – new in Java 7:

Image

Another example of support better Java coding are the enhanced settings for managing Java Imports:

Image

A feature that is frequently useful, especially for copy and paste operations, is a block (or column) select. NetBeans 7.1 introduces that option:

Image

Maven 3 support

I have worked a little with NetBeans 7.0 and found the support for Maven truly valuable. In 7.1 this support apparently has been even further extended. In short what NetBeans can do is open projects based on a Maven pom.xml file. No additional project files are created or needed. The project is the pom.xml and the resources and subdirectories in the directory containing the pom file.

A new project can be created based on a Maven Archetype for a certain framework or type of project. By simply picking the archetype, the appropriate pom.xml file is created by Maven, integrated in NetBeans. All dependencies and the required goals are included. Getting a new project up and running has never been easier. My own experiences with the cometd + jQuery + Jetty archetype – that was not included in NetBeans and first had to be added – were amazing (I will shortly describe this in a follow up article).

Image

Miscellaneous

Other new features in NetBeans 7.1 include better CSS 3.0 editing, integrated enhanced Git support and more features for PHP en C/C++ editing. I am sure there are many other smaller improvements that I have not spotted yet.

2 Comments

  1. Jhonye Clayde January 10, 2012
  2. John Yeary January 10, 2012