Chapter 8. Web services with style

 

This chapter covers

  • Calling a web service
  • Parsing an XML document
  • Dynamically editing the scene graph
  • Animating, with off-the-shelf transitions

In this chapter we’re going to cover a range of exciting JavaFX features—and possibly the most fun project thus far. In previous chapters we were still learning the ropes, so to speak, but now that bind and triggers are becoming second nature and the scene graph is no longer a strange alien beast, we can move on to some of the power tools the JavaFX API has to offer.

We’ll start by learning how to call a web service and parse its XML response. As more of our data is moving online and hidden behind web services, knowing how to exploit their power from within our own software becomes crucial. Then we’ll turn our attention to taking the pain out of animation effects. As if the animation tools built into JavaFX Script weren’t enough, JavaFX also includes a whole library of off-the-shelf transition classes. When we apply these classes to scene graph nodes, we can make them move, spin, scale, and fade with ease.

This chapter has a lot to cover, but by the time you reach its end you’ll have experienced practical examples of most of the core JavaFX libraries. There are still plenty of juicy morsels in the remaining chapters. But after this we’ll be focusing more on techniques and applications than on learning new API classes.

Let’s get started.

8.1. Our project: a Flickr image viewer

8.2. Using a web service in JavaFX

8.3. Picture this: the PhotoViewer application

8.4. Size matters: node bounds in different contexts

8.5. Summary