Developing Java Desktop Applications

Less than ten years ago developing a desktop application using the Swing classes was still a painful process due to the lack of good WYSIWYG editors and the unmanageable amount of boilerplate code generated. Without being an outstanding tool, the Netbeans visual editor was the best choice at the time.

The WindowBuilder Pro plugin for Eclipse tipped the scale back in favor of other major free IDE in the market. It still is arguably the best and most powerful drag-and-drop GUI editor for Java Swing.

Nowadays there is a superior alternative with JavaFX and the JavaFX Scene Builder visual editor.

JavaFX is a software platform intended to replace the Swing library, included in the standard JDK since Java 8 and still under active development. 

JavaFX Scene Builder is a visual editor for JavaFX that works as a stand-alone application but also is easily integrable in Eclipse and Netbeans.

Not only JavaFX includes many more features than the Swing library but it also provides richer components and a slicker look-and-feel.

These are the steps to integrate it in the Eclipse IDE after downloading and installing it:
  • Install the e(fx)clipse plugin in Eclipse.
  • Open the Preferences window, go to JavaFX and click on browse... to navigate to the executable. After that, again in Preferences, go to File Associations (simply type it in the search box). Select the .fxml type and associate it with the editor so that eclipse will launch the Scene Builder on opening this type of file.
The JavaFX Scene Builder tutorials hosted by Oracle are not that good and also somewhat dated. I found this introductory tutorial to be much more clear and useful.

Another good introductory resource is JavaFX for Dummies. It does honor the title. This is a book for beginners and if you are an experienced Java programmer you'll skip some parts in it, but it is well organized and has plenty of little working examples. It doesn't cover any visual editor, but I think that's a plus. It's possible to get acquainted with the controls and write small programs with a text editor since the code doesn't contain as much boilerplate as the typical Swing application and it paves the way to using JavaFX Scene Builder later to produce more sophisticated GUIs.

Comments