A nice little set of articles by Henry Zhang and Jim Weaver at O’Reilly’s InsideRia.com detail how Zhang wrote a PacMan game in FX. From the article:

When I was young I was fascinated by arcade games. One of my favorites was the Pac-Man game. Recently, when I was learning the JavaFX language, I decided to write the game in JavaFX. Based on my experience in other programming languages, I assumed there would be some amount of work in building a game such as Pac-Man, giving me a good feel for RIA development in JavaFX.

A quick perusal reveals at least one no-no that we should document better: never subclass the Shape classes. They weren’t meant to be subclassed, and if JavaFX Script gave us “final” we’d have used it. Rather, use a CustomNode. The only three Node classes in JavaFX 1.2 that were intended to be subclassed were CustomNode, Control, and Container.

I’m not sure anything bad will happen to you if you subclass one of the shapes, maybe we’ll relax this restriction in the future. Primarily, we just never intended this usage. But hey, sometimes the best things aren’t intended! Its great to see some detailed examples coming out about JavaFX, can’t wait to see more!