10 Minute Tutorial - JavaFX: Basic 2D Graphics and Animation
Update:
This tutorial will NOT work on the recently released JavaFX Preview SDK. In the move from JavaFX Script to compiled JavaFX code, much of the language and libraries have changed. Since the language and APIs continue to change at a rapid rate, I will not update this tutorial until they have stabled a bit more. If you want to see some JavaFX code that works under the JavaFX Preview SDK, you can read my JavaFX Hello World tutorial, and also look at these sites:
- James Weaver’s JavaFX Blog (contains many tutorials and sample code using the latest JavaFX build)
- OpenJFX Home (has the latest news on JavaFX)
- JavaFX Script Programming Language Migration Guide (a guide that details how to migrate JavaFX Script, like the code in this tutorial, to compiled JavaFX)
- JavaFX API doc (the latest documentation for JavaFX from the nightly builds)
Feel free to read on….
My last JavaFX tutorial beared one part fruit and one part pain. Clearly, more bugs need squishing and more language features need exercising before JavaFX can even hope to call itself “beta” quality. But, each code drop does get better and better, and even now, I can tell that the end product will turn out nice. So…
…we will press on.(not the greatest movie, but that scene gets me everytime!)
JavaFX, due to its declarative syntax, promises to empower developers with the ability to quickly build engaging user-interfaces by leverage eye-popping effects and animations to deliver a deeper, more visceral experience. But, you’ve got to walk before you run so this tutorial will explore JavaFX’s basic animation concepts by creating a simple slideshow containing various shapes. For added fun, each slide will have the ability to rotate. While eye-popping it is not, I think this tutorial will give you a good starting point to begin working on more complex animations. Read more