Tutorial Goal

In that tutorial, you’re going to learn how to create your first JavaFX Application with VS Code.

Application : Generate random UUID series (Universally Unique Identifier) which is a 128-bit number used to identify information in computer systems.

//Example
123e4567-e89b-12d3-a456-426655440000
xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx

Project Files Structure

JavaFX Application Structure

Stage, Scene and Nodes are the three major components used in JavaFX application based on the following diagram:

1. Imports

import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import java.util.UUID;

//or
// import javafx.scene.control.*; 
// import javafx.scene.layout.*;

2. Stage

start(): represents the main container (window) of the application*.***

Stage object: an argument of Application class.

show(): used to display the contents of a stage.

public class App_gui_tp01 extends Application { 
    @Override
    public void start(final Stage primaryStage) throws Exception {
        primaryStage.setTitle("UUID Generator");
        primaryStage.show();
    }

    public static void main(final String[] args) {
        Application.launch(args);
    }

}