You are on page 1of 2

JavaFX is cool, better than gtk at least (in terms of complexity and resources available).

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

A transformation in JavaFX is a modification of the properties of a node (my own personal


interpretation). Simple transformations like translation and such are executed on 3 axes: X, Y and Z.
The basic 2D transformations are:
• Translation, it moves the element by a number of pixels along the X or Y axis.
• Scale, it enlarges the element by a certain ratio
• Rotation, it determines the angle at which the node is rendered

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

You might also like