Professional Documents
Culture Documents
Architecture
Architecture
Architecture
At the top of a JavaFX application there is a stage, a representation of a native OS window. At any
given time a stage can only have on scene attached to it. A scene is a container for all the node
objects. All elements in JavaFX are represented as nodes. There are 3 types of nodes:
• root, it is the ancestor of all the other nodes and it is directly contained by the scene
• branch, it is a child node that has other children
• leaf, it is a child note that has no children
Many properties of the parent node are shared by the children nodes. A node also can only have one
parent, and if a node is currently active (in the current scene)
Transformations
Event handling
An event notifies that something happened. Events are typically the primitives of an event system.
Generally an event system has these 3 goals:
• To fire, triggering an event
• to notify the listeners, the ones who are “interested” in it
• to handle, or process the event
The event notification part is done by JavaFX automatically, so we only need to worry about how to
fire, listen and handle them.
EventType<T extends Events> is a class that is used to define the possible outcomes of
the event. They form a hierarchy with the ROOT event the ancestor of all the other event types.
generally the ANY EventType is the common supertype of all the other event types.
Program flow
It is good practice to write the content of the programs in the start() abstract method and then
calling it by putting the Application.launch() static method in the main
Stage
To display the content of a stage you have to invoke the show() method from a Stage object.
ObservableValue
Super cool interface that allows the values of an object to not be static, it allows you to define an
addListener() method that handles the events in which the value of the object changes