État initial de JavaFX

État initial de JavaFX Main.java

Main.java


import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class Main extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception{
        Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
        primaryStage.setTitle("Hello World");
        primaryStage.setScene(new Scene(root, 300, 275));
        primaryStage.show();
    }


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

Controller.java

Controller.java



package sample;

public class Controller {
}


sample.fxml

sample.fxml




<?import javafx.scene.layout.GridPane?>

<GridPane fx:controller="sample.Controller"
          xmlns:fx="http://javafx.com/fxml" alignment="center" hgap="10" vgap="10">
</GridPane>


Recommended Posts

État initial de JavaFX
Résumé de l'état initial du contrôleur de l'appareil
Texte JavaFX
Mémorandum JavaFx