2 import javafx.application.Application;
3 import javafx.event.ActionEvent;
4 import javafx.event.EventHandler;
5 import javafx.geometry.Insets;
6 import javafx.scene.Scene;
7 import javafx.scene.control.Button;
8 import javafx.scene.control.Label;
9 import javafx.scene.layout.BorderPane;
10 import javafx.stage.Stage;
19 public void start(Stage primaryStage) {
20 BorderPane root =
new BorderPane();
21 Label label =
new Label(
"Hello World!");
22 Button button =
new Button(
"Press me!");
23 BorderPane.setMargin(button,
new Insets(10));
25 button.setOnAction(
new EventHandler<ActionEvent>() {
28 label.setText(
"Well Done!");
31 root.setCenter(label);
32 root.setRight(button);
33 Scene scene =
new Scene(root);
34 primaryStage.setScene(scene);
40 public static void main(String[] args) {