Check out example codes for "CodersLegacy JavaFX tutorial". It will help you in understanding the concepts better.

Code Example 1

package application;
 
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
 
public class Tutorial extends Application {
 
    public static void main(String args[]){          
         launch(args);     
    } 
         
    @Override    
    public void start(Stage primaryStage) throws Exception { 
         
        StackPane layout = new StackPane();
        Scene scene = new Scene(layout, 400, 300);                      
     
        primaryStage.setTitle("CodersLegacy");
        primaryStage.setScene(scene);   
        primaryStage.show();
    }
}

Learn ReactJs, React Native from akashmittal.com