Perhaps it’s best to start by explaining one thing this book categorically is not: JavaFX in Action is not a retread of readily available online documentation. If you want that kind of thing, no doubt other books will suffice. In the age of search engines and IDEs with context-sensitive help, a complete list of functions for a given class is never more than a few keystrokes away. API documentation is plentiful—what’s usually lacking is an explanation of how the various classes fit together, and interact, to solve particular problems.
This book seeks to teach JavaFX from first principles through practical examples instead of merely repackaging API documentation. The opening third (chapters 1 to 3) introduces the platform and the JavaFX Script language, while the remaining two-thirds (chapters 4 to 11) use a project-driven approach to study the JavaFX APIs.
The overriding theme of the book is cool ways to learn a cool technology. The projects are fun, the text permits itself occasional flashes of humor (without being overly flippant), and the problem/solution format brightens up even the most mundane parts of the API. But the text doesn’t shy away from hard-nosed technical detail when necessary: if you want to understand why, and not just how, this is the book for you.
JavaFX is a brash, new, energetic, and entertaining technology—this book attempts to capture that spirit: an invaluable desktop companion, alongside the official API documentation.
Each project chapter begins by outlining an application with specific needs and challenges and then shows how to develop the code to meet those needs. At the end of the chapter the reader has a working program that doubles as a framework for further experimentation on the topics covered in the chapter. The project types range from puzzle games to data-driven forms. Some chapters also contain mini-bonus projects, extending the techniques of the main project into a business-oriented context when appropriate or covering ad hoc related topics.
Although each chapter stands as a tutorial in its own right, the book as a whole is designed to slowly build competence with core JavaFX tools, classes, and techniques. Early chapters use only simple scene graph structures (the data determining what’s drawn on screen), but slowly the complexity builds, chapter on chapter, as the reader acquires more familiarity with scene graph code.
JavaFX in Action requires prior knowledge of software development. A familiarity with Java would be very useful, although not absolutely necessary. The book does not cover IDEs or other development tools (except if they are specifically part of the JavaFX SDK or associated packages), but it does contain the URLs of tutorials and other resources that may be of interest to users of specific IDEs or tools.
Prior experience with graphics and animation is not required, although a familiarity with programs such as Adobe Photoshop, Adobe Illustrator, or Inkscape would be handy if you want to adapt some of the code demonstrated in later chapters to your own projects.
Chapter 1 acts as an introduction to the world of rich internet applications and explains JavaFX’s place within it. This chapter briefly compares JavaFX to its main commercial rivals and shows a couple of code examples as a taster.
Chapters 2 and 3 introduce the JavaFX Script language, using short and to-the-point examples to demonstrate each syntax variant and language feature.
Chapter 4 is the first project chapter, focusing on practicing newfound JavaFX Script skills (like binds and triggers) to build a Model/View/Controller–based application. The project shows how to use Swing from within JavaFX. The bonus project looks at using binds to validate a form.
Chapters 5 and 6 introduce scene graph coding: animation, layouts, effects, mouse events, and node manipulation. Chapter 6 also covers video playback, while its bonus project explains how to embed custom fonts into a JFX application.
Chapter 7 looks specifically at building business-centric applications, using JavaFX’s standard chart and UI control libraries. This chapter also covers device-agnostic persistent storage, and the bonus project deals with writing your own controls.
Chapters 8 considers web services, parsing data formats, and off-the-shelf animation classes.
Chapters 9 and 10 deal with writing cross-platform applications for web applets and cell phones. Chapter 9 also looks at the designer/programmer workflow and considers how to import designer artwork into JavaFX applications and manipulate it.
Chapter 11 is a short chapter on using JavaFX from within a Java program.
Appendix A tackles what to download and install to develop JavaFX code, including IDE plug-ins. It also provides URLs of useful resources.
Appendix B is a JavaFX Script reference, with fragments of code demonstrating all the syntax patterns and conventions.
Appendixes C and D provide background material for readers unfamiliar with the Java platform or whose programming experience may be limited (for example, someone whose primary skills lie in graphic design, not full-time programming).
When appropriate, the text may briefly mention other topics or techniques as they relate to the problems being solved in a given section. Consult the table of contents or the index for an indication of whether specific topics are covered.
Courier is used for listings, language keywords, class names, variable names, function names, and any other identifiers (elements the JavaFX Script compiler would recognize) relating directly to the source code.
Faint courier in listings represents code unchanged from a previous revision. Because some projects develop their code over more than one revision, this allows the reader to quickly see the differences between a new version of a listing and its previous incarnation.
Bold courier in listings is used to annotate source code edits made for the benefit of the manuscript. For example, large blocks of repeating code might be replaced by a comment, in bold, explaining that the listing has been summarized for the sake of readability.The source code for each project chapter and the language introduction chapters are available for download as an archive from the book’s website, at http://www.manning.com/JavaFXinAction.
Some projects are developed in stages, over successive versions, throughout the course of a chapter. When this is the case, the code for each individual version is presented separately and complete, in a version subdirectory within the chapter’s main directory. Required resource files for each version are also bundled correctly inside each version’s subdirectory.
The source code archive does not contain IDE-specific project files but is laid out in such a way as to make it easy to import into an IDE.
JavaFX is a fast-moving technology, each release not necessarily backward compatible with existing releases. This book covers JavaFX 1.2, the first version featuring a full complement of standard UI libraries, which should limit breaking changes in later releases.
In order for readers not to be caught out by updates, for a reasonable period after publication, the author will post revised source code for new JavaFX releases, along with brief notes updating each chapter, to his site at http://www.jfxia.com/. The updates will also be available from the publisher's website at http://www.manning.com/JavaFXinAction.
Purchase of JavaFX in Action includes free access to a private web forum run by Manning Publications where you can make comments about the book, ask technical questions, and receive help from the author and from other users. To access the forum and subscribe to it, point your web browser to http://www.manning.com/JavaFXinAction. This page provides information on how to get on the forum once you are registered, what kind of help is available, and the rules of conduct on the forum. It also provides links to the source code for the examples in the book, errata, and other downloads.
Manning’s commitment to our readers is to provide a venue where a meaningful dialog between individual readers and between readers and the authors can take place. It is not a commitment to any specific amount of participation on the part of the author, whose contribution to the Author Online remains voluntary (and unpaid). We suggest you try asking the author some challenging questions lest his interest stray!
The Author Online forum and the archives of previous discussions will be accessible from the publisher’s website as long as the book is in print.