Game Development Reference
In-Depth Information
event types, and even different programming approaches to event handling, will ulti-
mately be required. We'll take a look at what input events are currently supported in
Java 8.
It is also interesting to note that Java 8 and JavaFX apps are already working on
these embedded platforms, and I'd put money on native support on open platforms
(Android, Tizen, Chrome, Ubuntu), and proprietary platforms that currently support
Java technology (Windows, Blackberry, Samsung Bada, LGE WebOS, Firefox OS,
Opera, etc.), at some point in time in the near future. The future of Java 8 is bright,
thanks to JavaFX and hardware platform support!
Java 8 and JavaFX Events: javafx.event
and java.util
As you have seen, the javafx.event package's EventHandler public interface, which
extends the java.util package's EventListener interface, is the way that Event objects
are created and handled, either using an anonymous inner class (Java 7) structure, or a
lambda expression (Java 8). You have become familiar now with how to code both of
these types of event handling structures, and I will continue during this topic to initially
code methods using the Java 7 (anonymous inner class) approach, and I will then use
NetBeans to convert them to Java 8 lambda expressions so that you can create games
that are compatible with both Java 7 (Android) and Java 8 (PC OS) game code delivery
pipelines.
The ActionEvent class (and objects) that you've used thus far during the topic for
your user interface Button control event handling is a subclass of the Event superclass,
which is a subclass of the java.util package's EventObject superclass, which is a sub-
class of the java.lang.Object master class. The entire class hierarchy is structured as
follows:
java.lang.Object
> java.util.EventObject
> javafx.event.Event
> javafx.event. ActionEvent
The ActionEvent class is also in the javafx.event package, along with the
EventHandler public interface. All of the other event-related classes that we will be us-
ing from here on out are contained in a javafx.scene.input package. I am going to fo-
Search WWH ::




Custom Search