I'm a server side Java developer with 10 years experience, and 2 years experience in
Adobe Flex. With Flex taking a recent slating in the press, I decided it was time to broaden my UI experiences to
JavaFX and HTML 5 with Java Script. Because I know Java well, and having previous experiences with Swing, I chose
JavaFX and this was the book I chose to help me learn the basics.
The first thing to note about this book is it's written by the key people behind the
JavaFX technology. The advantage of this is the reader is immediately learning how the platform was designed and intended for use.
The book is split into 10 chapters, each with comprehensive code listings on how the examples and components are built. The chapters are outlined below, along with how I found them useful in the work we have been doing building a basic
Java Memory Visualizer in
JavaFX.
Getting a Jump Start in JavaFX
The book begins with a brief history of JavaFX, and discusses the original version and the introduction of 2.0. The book goes immediately into an example, building an application using a Java Class extending Application. There's also enough to get started in this chapter with getting Netbeans set up and ready to go to build your applications. There's a lot of content here, so don't let this put you off. There's some important code segments that you will probably need to flick back to along the way. My only observation at this point would be remember that there is still the option of using FXML to simplify a lot of the code that is in this chapter - so this chapter should be viewed as a primer.
Creating a User Interface in JavaFX
We're back out of the deep end now and will be walked through the scene and layouts of creating a typical user interface. This chapter is critical to when you come to build your own UIs. If you want to grab a chapter to help you get started quickly this would be the one. One minor criticism would be this would be a good chapter one, but I can appreciate why leading with an example is good. It really depends on your learning style if you want to read this chapter first. After some theory there is a whole host of examples for you to try and figure out, all with both screenshots and code samples. This is a real codex of information, for me I found reading the first part and trying the second part with my own examples worked best.
Properties and Bindings
Binding is a simple concept, but there are some subtleties that need to be appreciated when building JavaFX applications. The first part of the chapter is split into titles of
Understanding X, which makes it easy to refer back to later. Once again, everything is backed up with an appropriate example that demonstrates the power of bindings. This chapter is similar to the previous, the first part of the chapter is easy to read for theory but the latter is example heavy. I'd use the latter part of the chapter as a reference to come back to once you start writing your own code.
Building Dynamic UI Layouts in JavaFX
We used the concepts that are in the Reversi example for the foundations of our Java Memory Visualizer to manipulate memory cells that are on the screen. This example is again in the format of extending Application, but building out components on there. We built our application using FXML based on the information from this chapter. There is enough in this chapter to build your own board game, or if you are building any binding state UI I'd recommend reading this chapter.
Using the JavaFX UI Controls
I personally haven't read this chapter in great depth as I view it as a reference chapter. It looks like this is the codex for building your own controls.
Collections and Concurrency
In chapter 6 we're really going back to basics, so in my opinion this is not a chapter you can shelve for later. For the collections part, if you are familiar with Flex, ObservableList reminded me of ArrayCollection. The concurrency section introduces the threading model that is used in JavaFX, and that it is single threaded like most other UI frameworks. The JavaFX tasks are then explained for removing logic from the main application thread to avoid bloating your application re-render. Personally when we approached this, due to the nature of the simulation, we used plain old java.util.concurrent.
Creating Charts in JavaFX
Great overview into building charts in JavaFX and shows off the power of what is capable in the API. Examples and screenshots are available to get you started with what you are trying to build.
Using the Media Classes
Because of the type of work I do it's likely I'll never get to do any of the fun stuff in this chapter. I've saved this one for a rainy day, although on a quick parse it does look like a chapter I will genuinely come back to.
Accessing Web Services
An awesome chapter with practical examples of how you would integrate your JavaFX client with real world technologies. This sample walks you through creating a REST API call to twitter, using JAXB to create an appropriate response and display the information. If you are looking at using this for EE work this would be a good chapter to read.
JavaFX Languages Markup
In this chapter we see some other languages using JavaFX (Scala and Groovy). The finally we get to the section on FXML. The sample is fairly simple and somewhat limited, it would have been good to have seen more of this earlier.
Summary
This is an excellent book to have if you are trying to do anything with JavaFX. Although the online documentation is getting better, this book provides an awesome introduction to most components, tricks and tips that you would need to get started in this space. My only criticism of the book is a lack of FXML examples and that it only really appears at the end of the book. This shouldn't take away however from some of the excellent explanations and examples in this unfamiliar space. It's also worth noting that with a bit of playing around it's very simple to convert the samples over to using FXML.
5/5 - I bought this with my own money and don't want it back :-).