JavaFX for my kids


A year ago, I quickly developed a small application to learn my kid to use a keyboard and create words by typing letters. The application shows a word (usually the first name of a family member) and he must type the same word by clicking on the keyboard letters.

The application is providing sound-based feedbacks to pronounce the first name and each letter typed.

I used Java and Swing, the result is showed in the screen shot below.


Pretty simple but highly effective, my 4 years old boy loves to play this little game.

As you can see from the screenshot above, I am a software guy, not an graphical artist.

When JavaFX came in last December, I wanted to see how easy (or not) it would have been to re-write this application with a somewhat more appealing and modern graphical user interface.

The result is this new application, entirely similar in terms of functionalities but with a different look and feel.


I also added some animations, the letter symbols zoom in and out when the mouse is over the letter and the box is highlighted when the user clicks on it.

There is more or less 500 lines of JavaFX code needed to write this application, roughly 20% less lines of code than the β€œequivalent” Swing application.

For the curious, you can download the source code.


  1. #1 by Vaibhav on 04/01/2009 - 02:57

    Nice Application. Its running though I am getting exception too :

    Sounds Directory = file:///D:/NetBeansProjects/lettersfx/dist/lettersfx.jar!/lettersfx/
    FX Media Object caught Exception com.sun.media.jmc.MediaUnavailableException: Media unavailable: file:///D:/NetBeansProjects/lettersfx/dist/lettersfx.jar!/lettersfx/q.au
    source =’file:///D:/NetBeansProjects/lettersfx/dist/lettersfx.jar!/lettersfx/q.au’
    com.sun.media.jmc.MediaUnavailableException: Media unavailable: file:///D:/NetBeansProjects/lettersfx/dist/lettersfx.jar!/lettersfx/q.au
    at com.sun.media.jmcimpl.PeerManager$1.run(PeerManager.java:56)
    at java.security.AccessController.doPrivileged(Native Method)

    So, are we comparing the above Swing application with the above JavaFX Application. 20 percent less code + a better UI >> Not bad πŸ™‚

  2. #2 by Sebastien Stormacq on 04/01/2009 - 08:01

    Hello, Thanks for your comment.
    I did not include the sound files (one file for each letter, one for each name + a "Won !" sound)
    The paths to these sounds are hardcoded in Constants.fx
    You will need to provide sounds recording and fix the path to benefits from the sounds. Otherwise the application should just run without sounds and with plenty of exceptions when accessing the sounds file πŸ™‚

    Seb

  3. #3 by Jim Weaver on 04/01/2009 - 08:10

    Sébastien,

    Thanks for this. Would you mind including a Java Web Start link?

    Thanks,
    Jim Weaver
    JavaFXpert.com blog

  4. #4 by Sebastien Stormacq on 04/01/2009 - 08:19

    I am still having issues to start the application outside NetBeans πŸ™ Sounds file are either not found or not played. I will write a small test case and seek assistance in mailing lists and forums … then I will post an online version

  5. #5 by Vaibhav Choudhary on 19/01/2009 - 02:13

    Converting in JNLP is little easier. You can try out my blog link which tells how to do that πŸ™‚

    http://w3hjava.com/javafx/javafx-samples-in-jnlp-style/

(will not be published)