Pro Java 9 Games Development Leveraging the JavaFX APIs

(Michael S) #1

Chapter 7 ■ IntroduCtIon to JavaFX 9: overvIew oF the JavaFX new MedIa engIne


iOS,” and you can bet that by 2018 that Android OS, iOS, BlackBerry, and Tizen OS devices will be running
JavaFX applications “natively.” This will allow you to “code once, run everywhere” with this Java and JavaFX
dynamic duo! What I mean by native is that you will someday be able to export Java (and JavaFX engine)
apps directly to Android 8 using JetBrains IntelliJ 2017 Android Studio or to iOS or Tizen OS, or possibly
even directly to Android 8, using NetBeans 9. This will add to the Windows, Mac, Open Solaris, and Linux
distributions support currently afforded by NetBeans 9.


■ Note the JetBrains IntelliJ IDEA is now the official Ide used for creating 64-bit android 8 applications.


this Ide is covered in my Android Apps for Absolute Beginners (apress, 2017), which covers developing


64-bit android 5 to 8 applications using the IntelliJ Idea using Java 8. IntelliJ is also covered in my Pro Android


Wearables (apress, 2015). I expect Java 9 will also feature support for wearables and appliances by the


end of 2018.


Let’s start at the top of the diagram shown in Figure 7-1 and take a look at the JavaFX Scene Graph and
the javafx.scene package, which implements the Scene Graph in the JavaFX API using 16 powerful and
useful Java classes.


The JavaFX Scene Package: 16 Java Scene Classes


The first thing that I want to do after our high-level overview is take a look at one of the most important JavaFX
packages, the javafx.scene package. As you have seen in Chapters 2 and 3 , there is more than one JavaFX
package. As you can see at the top of Figure 6-7, your JavaFXGame.java application is already using four
different JavaFX packages. The javafx.scene package contains 16 powerful Java classes (remember JavaFX
was recoded in native Java) including Camera, ParallelCamera and PerspectiveCamera, Cursor and
ImageCursor, LightBase, PointLight, and AmbientLight, as well as the Scene Graph classes (Node, Parent,
Group, Scene, and SubScene) and some utility classes seen in Figure 7-2. As you can see, I have grouped
these 16 javafx.scene package classes logically. I have the Scene class inside of the Scene Graph section of this
diagram because Scene objects that are created using this Scene class will contain Scene Graph objects that
are created using the other four Node, Parent, Group, and SubScene Scene Graph–related classes, and their
subclasses. We’ll be covering all of these Scene Graph classes in detail a bit later during the chapter.

Free download pdf