JFXtras 0.1 Release – Grids, Dialogs, Testing, and more!

29 12 2008

The JavaFX 1.0 release came out a couple weeks ago, but one of the big questions has been about missing UI functionality, such as layouts, menus, and UI components.  Future release of JavaFX will support this, but in the meantime application developers are stuck up the river without a paddle.

The JFXtras project was conceived out of just such a discussion between Jim Weaver and I as we were brainstorming on all the missing functionality we wished JavaFX supported today.  As a starting point we each had a repository of components and widgets to share, and an endless list of things we wished we had to work with.

Today marks the 0.1 milestone release of JFXtras.  The components are not all complete, but are well documented and very usable for early adopters.

JFXtras Grid in Action

JFXtras Grid in Action

Some of the out-of-the-box components you can take advantage include:

  • The JFXtras Grid – Absolute positioning only goes so far, then you need some real layouts.  The JFXtras Grid supports resizable nodes, alignment, span, grow, and even column widths.
  • Dialog – The JFXtra Dialog provides a drop-in replacement for a Stage that will pop-up a real Java Dialog. This includes support for an owner window, modality, alwaysOnTop, the ability to hide the taskbar icon, and many other features.
  • Testing – The JFXtras test takes all the best testing concepts from junit, hamcrest, rspec, and others, and melds them together with a succinct declarative syntax.
  • Asynchronous Worker – Working on the theory that developers deserve their share of rope, JFXtras provides an asynchronous worker wrapper that allows you to execute pure JavaFX code on a background thread.

I will be writing in more depth about how to use the main features of JFXtras here on my blog, so please look forward to it!

Advertisements




Migrating from the JavaFX Preview Release

7 12 2008

Now that the JavaFX 1.0 Release is out, it is time to dust off all your old JavaFX code and fire it up, right?  Well, not quite…  There were a whole lot of changes in the span of a few months, and it is guaranteed that your program will need a little TLC before it runs.  Fortunately, I’ve already gone through this pain on a relatively large codebase (WidgetFX), and can share what I learned.

Language Changes

  • Change “attribute” to “var”/”def” – There is no more attribute keyword, but it is a simple search and replace to change it to var everywhere.  On a second pass you might want to convert vars that are never changed to def for efficiency.
  • No More “static” – If you want to make a variable or function as static, just move it outside your class declaration.  If it is declared public you can access it from anywhere else just by prefacing it with the file name, no static modifier needed.
  • New Access Modifiers – The default access modifier was changed to private rather than package, so you need to change any attributes or functions that had no modifier to package and then can delete all references to private.  On a second pass it may be a good idea to button-up permissions by using the new public-init and public-read permissions.  Here is a quick-reference table:
    Preview 1.0 Migration
    private default Remove this keyword everywhere
    default package Add package anywhere no modifier was specified
    protected protected No change
    public public No change
    N/A public-init Use this anywhere the user should be able to initialize and read, but not update
    N/A public-read Use this anywhere the user should be able to read, but not initialize or update
  • Required “override” – It is now mandatory that you use the override keyword on any member variable or function that exists in the superclass.  Expect to be going through lots of compiler errors to find all the places you need to fix this…
  • {} Instead of “+” for Concatenating Strings – While the java-esque “+” operator for concatenating strings was an easy habit to fall into, it is no longer valid.  Instead you have to use the {} syntax to build strings.  For example, rather than “hungry for: ” + meat, you would write “hungry for: {meat}”.
  • Keyframe Syntax – While this is not required to get your code working, there is a new KeyFrame syntax for doing animation that has the potential to make your code much shorter.  Rather than creating an instance of the KeyFrame class you can simply write “at (duration) {x => y}”.

Read the rest of this entry »





WidgetFX @ the JavaFX 1.0 Launch

6 12 2008

Thursday evening was the big JavaFX 1.0 Launch, and the WidgetFX crew was not going to be left out, so we crashed the party in style.

The event was an all-star line-up kicked off by Jonathan Schwartz in full-blazing ponytail style.  He went over the full vision of code ubiquity between the desktop, set-top boxes, DVD players, and mobile devices, but I was too mesmerized by the cool slide transitions to really pay attention.

This was followed on by a very animated Eric Klein who felt like he was on the verge of jumping out into the audience to share his overflowing enthusiasm.  He was also joined by a beaming Nandini Ramani with demos aplomb:

Nandini and Eric Demo JavaFX

Nandini and Eric Demo JavaFX 1.0

Read the rest of this entry »