Archive for December 2008

Screen Ruler with javaFX

Some weeks ago JavaFX version 1.0 was released. After some very busy days and Christmas holidays, I’ve finally found a few hours to spend on it.

My goal was to create a ruler application with guideLine, measuredArea and other things like that. In the same time I’ve been exploring the JavaFX 1.0 API.

Add guideline and mesaured area

Add guideline and mesaured area

Try it

When developing this small project of mine, I discovered some great features and at the same time I’ve found a few issues with javaFX.

That’s what I like:

  • Binding. It’s very powerful. I ‘ve been using binding in flex but with JavaFX the concept is much more stretched to its limits.
  • API. The basic API is quite good being a 1.0 release. They can improve some things but as a first step, it’s definitely a very good one.
  • Skinning. I haven’t used it already. Anyway it looks quite promising.
  • CSS. I hoped I wuold have found more examples and documentation. Anyway it’s useful.

And here are some issues:

  • Transparent objects don’t fire events. At the moment I’m using a workaround (i.e. setting opacity:0.1)
  • TextBoxes don’t have onFocusLost and onFocusGain events. There are also some workarounds here.
  • Code Hint and Debug features (in NetBeans IDE) need more enhancements and fixes

My application works consists of 4 Classes and a Main one as launcher:

  • GuideLine (from rulers you can drag an horizontal and vertical guide)
  • Rulers (draws rulers on vertical and horizontal side)
  • MeasuredArea (a draggable and resizable Colored Rectangle)
  • MeasuredLine (a red line is drawn beetween two Guidelines on rollover)
  • Main (Launcher application and some handler functions)

You can found a NetBeans project here