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

3

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.

Share.

About Author

Lucas Jellema, active in IT (and with Oracle) since 1994. Oracle ACE Director for Fusion Middleware. Consultant, trainer and instructor on diverse areas including Oracle Database (SQL & PLSQL), Service Oriented Architecture, BPM, ADF, Java in various shapes and forms and many other things. Author of the Oracle Press book: Oracle SOA Suite 11g Handbook. Frequent presenter on conferences such as JavaOne, Oracle OpenWorld, ODTUG Kaleidoscope, Devoxx and OBUG. Presenter for Oracle University Celebrity specials.

3 Comments

  1. Pingback: Create simple Java application to post JSON message to CometD Bayeux Channel using Apache HttpClient and Maven style NetBeans project « AMIS Technology blog

  2. congratulations very good article by topic
    more … I wonder … I thought JFX integrated into the java platform
    as well as Swing and AWT?
     
    Perhaps it now becomes a reality after JDK 7 ind JDK  8 ?
    will be whether it would be a good idea?
    Chanse not had the test in mobile phones …
    more to this great desktop …. so the compactness with browsers that can do a little better ….
     
    very intereçante this topic
     
    My comment on the JFX?
    — JFX very satisfying =)
     
    sorry my Inglish very bad
    :)

  3. A very nice article. I liked the JavaFX portion, and I am excited to hear about the next article which you will do on Maven integration. I am finding the Maven integration very nicely done.

Leave a Reply