Chapter 5. Behind the scene graph

 

This chapter covers

  • Defining a scene graph
  • Animating stuff on screen, with ease
  • Transforming graphics and playing with color
  • Responding to mouse events

In chapter 4 we looked at building a rather traditional UI with Swing. Although Swing is an important Java toolkit for interface development, it isn’t central to JavaFX’s way of working with graphics. JavaFX comes at graphics programming from a very different angle, with a focus more on free-form animation, movement, and effects, contrasting to Swing’s rather rigid widget controls. In this chapter we’ll be taking our first look at how JFX does things, constructing a solid foundation onto which we can build in future chapters with evermore sophisticated and elaborate graphical effects.

The project we’ll be working on is more fun than practical. The idea is to create something visually interesting with comparatively few lines of source code—certainly far fewer than we’d expect if we were forced to build the same application using a language like Java or C++. One of the driving factors behind JFX is to allow rapid prototyping and construction of computer visuals and effects, and it’s this speed and ease of development I hope to demonstrate as we progress through the chapter.

5.1. What is a scene graph?

5.2. Getting animated: LightShow, version 1

5.3. Total transformation: LightShow, version 2

5.4. Lost in translation? Positioning nodes in the scene graph

5.5. Bonus: creating hypertext-style links

5.6. Summary

sitemap