View RSS Feed

A JavaFX Blog

  1. How to Filter JavaFX Events in a Scene Graph

    by , 12-11-2016 at 06:45 PM (A JavaFX Blog)
    JavaFX has a powerful event dispatch mechanism that allows different Node elements in a scene graph to intercept GUI events before and after they are delivered to their target node. Every time a new event is generated, an event dispatch chain is built for that event: this chain starts from the stage of the application window, continues with the scene displayed on that stage, and then follows the scene graph down to the target node of the event. For example, when a user clicks on a button in an application, ...
  2. Understanding JavaFX Event Types

    by , 12-11-2016 at 06:41 PM (A JavaFX Blog)
    In JavaFX, every event generated within an application has a type, which is represented by the EventType<T extends Event> class. An EventType<T> object represents a specific type of event within the T Event subclass. To identify common event types, most Event subclasses in JavaFX contain a set of static constants representing the different types of events within a given subclass. For example, the MouseEvent class contains static constants such as MouseEvent.MOUSE_PRESSED, MouseEvent.MOUSE_RELEASED ...
    JavaFX Events
  3. Reacting to User Input in a JavaFX Application with Event Handlers

    by , 12-11-2016 at 06:33 PM (A JavaFX Blog)
    In a GUI application environment, events are generated every time a user interacts with the application using the input devices of the computer where the application is running; typical examples of events are a click with the mouse or a key press on the keyboard. In JavaFX, events are represented by the javafx.event.Event class; this is a subclass of java.util.EventObject, which is the base class representing a generic event in Java. The EventObject class offers a basic functionality related events, ...
  4. Where GUI events happen: the JavaFX Application Thread

    by , 12-11-2016 at 06:20 PM (A JavaFX Blog)
    When a JavaFX application is launched, the JavaFX framework creates a thread (generally referred to as the application thread, or the event thread) that handles the GUI of the application: for example, all GUI-generated events (mouse clicks, key presses, etc.) are processed in this thread, and any event handlers defined by the application programmer are executed in this thread. This is also the thread that manages all the updates to the application GUI, so in order to keep the interface responsive ...

    Updated 12-11-2016 at 06:34 PM by JavaFX

    JavaFX Application , JavaFX Events
  5. The building blocks of a JavaFX GUI: Stages, Scenes and Nodes

    by , 12-11-2016 at 05:02 PM (A JavaFX Blog)
    In JavaFX, the central metaphors used to represent a graphical user interface are the stage and the scene.

    A stage is the “location” where graphic elements will be displayed; it corresponds to a window in a desktop environment. The javafx.stage.Stage class represents a stage; the so-called “primary stage” (which corresponds to the main window of an application) is created automatically by the JavaFX framework as soon as an application is launched, and is supplied as argument to the ...

    Updated 12-11-2016 at 06:17 PM by JavaFX

    JavaFX Stage , JavaFX Scene , JavaFX Examples , JavaFX Node
  6. The Life-Cycle Methods of a JavaFX Application

    by , 12-09-2016 at 06:51 PM (A JavaFX Blog)
    The methods of the javafx.application.Application class that define the life cycle of a JavaFX application are the following:

    • public void init()
    • public abstract void start(Stage primaryStage)
    • public void stop()

    The init() method is called right after an Application object is instantiated, and can be used for application-specific initializations; however, GUI operations such as creating stages or scenes cannot be done from within this method, because at the time ...

    Updated 12-11-2016 at 06:16 PM by JavaFX

    JavaFX Application
  7. How to Launch a JavaFX Application

    by , 12-09-2016 at 06:13 PM (A JavaFX Blog)
    The javafx.application.Application class, which defines a JavaFX application, can be launched by calling one of its two static launch() methods:

    • public static void launch(String... args)
    • public static void launch(Class<? extends Application> appClass, String... args)

    The first method takes as argument a set of application parameters, while the second method takes an additional argument indicating an Application subclass. The difference between the two methods ...

    Updated 12-11-2016 at 05:34 PM by JavaFX

    JavaFX Application