Custom components in JavaFX 1.3 – revisited


Last year, I posted some details about creating your own UI control using JavaFX, by subclassing the Node class and extending it the way you like.  For the sake of this example, I created a custom Search Control based on JavaFX’s TextBox

Last month, Oracle did release a new version of JavaFX, version 1.3.1.  This version includes a whole bunch of welcome changes but, unfortunately, some incompatible APIs changes.

Net result : my search text box sample is not compiling anymore.

When subclassing Node class, it is not longer permitted to override the create method.  Instead, developers must now use the children property.  This property contains an Array of Node instances.  You just rip and replace the component’s original array or you add your nodes into the array.

JavaFX 1.3 also introduces some subtile changes in the CSS properties names.  Specific JavaFX properties names are now starting with “-fx-

My modified sample application is available to download or you can just Java Web Start it by clicking on the “Launch” button below.

As usual, comments and remarks are welcome. Have fun !

  1. #1 by Lichti on 16/12/2010 - 14:32

    The jnlp download can not be launched!

(will not be published)