Pro Java 9 Games Development Leveraging the JavaFX APIs

(Michael S) #1

© Wallace Jackson 2017 151
W. Jackson, Pro Java 9 Games Development, https://doi.org/10.1007/978-1-4842-0973-8_7


CHAPTER 7


Introduction to JavaFX 9: Overview


of the JavaFX New Media Engine


Let’s build on the knowledge of the Java 9 programming language and the NetBeans 9 IDE that you reviewed
in the previous two chapters here in Chapter 7 ; we’ll review in detail the capabilities, components, and core
classes that comprise the JavaFX 9 new media engine. This JavaFX 9 new media UI and UX API was added
to Java using the javafx package that you saw in Chapter 6 when you created your bootstrap pro Java 9 game
application. The previous JavaFX 8 API was released with Java 8 and was also compatible with Java 7, as
well as Android and iOS. The JavaFX packages are significant to game programming because they contain
advanced new media classes that you will need to harness for game programming, including classes for
organizing scene components into a hierarchy using a Scene Graph, classes for user interface layout and
design, classes for 2D digital illustration (known as vector graphics), and classes for digital imaging
(known as raster graphics), 2D animation (vector and raster), digital video, digital audio, 3D rendering,
a web page rendering engine (WebKit), and much more. We’ll be touching on all of this in this chapter so
you’ll know what you have available for Java 9 games now that JavaFX has been added into Java as an API.
The rationale for going into the API detail overview early in the book is to get the creative side of
your brain firing so you can start to think about how the JavaFX new media engine features support your
pro Java game concept and design. Not only is it important that you know what JavaFX can do for your
games development, but all of the API classes are interrelated, so you need an overview of how the various
components of the JavaFX new media engine are put together. JavaFX uses a complex set of APIs that I like
to call the engine to implement incredible “front-end” power. This is because of the inherent power that it
brings to implementing User Interface (UI) and User Experience (UX) “wins” to your pro Java games and
IoT applications. So, bear with me regarding these “foundational” chapters that cover how to master your
IDE (NetBeans 9), your foundational programming language (Java 9), and a new media engine (JavaFX 8),
which is now an integrated Java platform API and which is rapidly growing in browser support, power, and
popularity.
In this chapter you will review the JavaFX QUANTUM toolkit, the PRISM rendering technology, the
WebKit web engine, the GLASS windowing technology, the JavaFX Media Engine, the JavaFX Scene Graph,
and the JavaFX API.
Once you take a look at how JavaFX comes together at the highest level, like you did in Chapter 5 for
Java 9, you will take a look at some of the key classes that you will be using to construct pro Java games.
These include Node, as well as the following: Group, Scene, Stage, Layout, Control, StackPane, Shape,
Geometry, Media, Image, Camera, Effect, Canvas, Paint, and Animation. We already looked at the JavaFX
Application class in Chapter 6 ; we will continue to learn about this class, as well as about the various classes
that can be used to build complex multimedia projects such as games.

Free download pdf