Learning JavaFX

This is my week off.  I had a nice little vacation planned with the family, but most of the family (except me, so far) has been sick with the flu for the past few days.  We postponed our little jaunt up north but I decided to take the time away from the office anyway.  I needed to keep an eye on the kids while my wife stayed in bed most of the last few days, but I also just needed some time away to do something different.  That something different?  JavaFx, of course.

Ever since the announcement at JavaOne last year I have been curious to check it out.  I was very skeptical about it at first, from what I could tell it looked a lot like Swing but in a scripting language.  I’m still not so sure it isn’t Swing in a scripting language, my old friend, the GridBagLayout is still around after all, but taking a look at it did encourage me to try some things I never really felt like dealing with in regular old Swing.

I decided I’d spend this time on my vacation writing a flash card game for my kids.  You all remember flash cards, right?  This particular version would have words on one side, an image on the other side, and hopefully, if I have time, be slightly enhanced with sound.  I want to encourage my oldest to learn to read phonetically, and I figured a flash card game in which she could click on the individual letters to hear the sounds they make may make it interesting.

I already learned a few things about JavaFX.  One is that it is enough like Java to really confuse me at times since it really isn’t Java and has different syntax.  Another is that some really simple things, like constructors, for example, take entire articles to explain.  I learned that displaying graphics is really easy, but playing a sound file isn’t, at least not until a sound api is incorporated into it.

The coolest thing is that with the NetBeans IDE and the plugin for JavaFX, there is an actual preview window that shows what the JavaFX file will display when it runs.  It also is essential in finding some errors.  It reminds me very much of the Smalltalk workspace in the Smalltalk Visual Studio I used to progam in decades ago.

One downside, though, JavaFX files are script files and they are not compile checked so some errors to not appear until runtime.  And besides that, I don’t think it is possible to debug either, if it is, it isn’t obvious.

Okay, three downsides, number two is that NetBeans will not install on my laptop and doesn’t give a reason why not.  Number three is that the language still seems a bit buggy to me and from what I have read recently, seems that way to others also.  It’s okay, though, I’ve been doing a lot of work with the pre-release versions of ADF 11g so I’m used to dealing with lacking documentation and a plethora of bugs.

I have gotten close to a milestone at this point and if we do end up going away for a few days and my laptop still won’t run NetBeans, I won’t be working anymore on it anytime soon.  I will do my best to provide some type of update, however, before I am back in the thick of things at the office.  It may be that I throw the code up here and let someone else play with it if they are interested.  Only time will tell.

Here are some links to get you started:

JavaFX Community Home 

JavaFX API 

Introduction to JavaFX Script

Share/Save/Bookmark

Related posts:

  1. JavaFX FlashCard Source Code and Web Start Link This is the post I promised that contains a link...
  2. Adding Sound to the FlashCard JavaFX Game I finally had a small amount of time to look...
  3. JavaFX Example - FlashCard Game Note: An updated version of the source code for JavaFX...
  4. Create and Deploy a JavaFX WebStart Application I realized when I updated my FlashCard JFX game that...
  5. JavaFX Flashcard Example Updated for 1.1 I have updated the sourcecode for my JavaFX flashcard game...

1 comment

  1. Adding Sound to the FlashCard Game | Java Hair

Leave a reply

You must be logged in to post a comment.