"Hallo Welt" mit Fenster und Knopf

import javafx.application.*; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.control.Button; import javafx.scene.layout.*; import javafx.stage.Stage; public class HelloFX extends Application { @Override public void start(Stage stage) { // Button Button btn = new Button(); btn.setText("Hallo Welt!"); btn.setOnAction( (event) -> Platform.exit() ); // Stackpane "root" Pane root = new StackPane(); >> // Knopf anfügen root.getChildren().add(btn); stage.setScene(new Scene(root, 300,150) ); stage.show(); } public static void main(String[] args) { launch(); } }