From 94a52684c7b93b22a25e67167a2db341b6a411b5 Mon Sep 17 00:00:00 2001 From: Eleanor Wai Date: Mon, 24 Jun 2024 01:32:16 +0000 Subject: [PATCH] HelloJavaFX --- HelloJavaFX.java | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 HelloJavaFX.java diff --git a/HelloJavaFX.java b/HelloJavaFX.java new file mode 100644 index 0000000..e4f899d --- /dev/null +++ b/HelloJavaFX.java @@ -0,0 +1,40 @@ +//************************************************************************ +// HelloJavaFX.java Author: Lewis/Loftus +// +// Demonstrates a basic JavaFX application. +//************************************************************************ + +import javafx.application.Application; +import javafx.scene.Group; +import javafx.scene.Scene; +import javafx.scene.paint.Color; +import javafx.scene.text.Text; +import javafx.stage.Stage; + +public class HelloJavaFX extends Application +{ + //-------------------------------------------------------------------- + // Creates and displays two Text objects in a JavaFX window. + //-------------------------------------------------------------------- + public void start(Stage primaryStage) + { + Text hello = new Text(50, 50, "Hello, JavaFX!"); + Text question = new Text(120, 80, "How's it going?"); + + Group root = new Group(hello, question); + Scene scene = new Scene(root, 300, 120, Color.LIGHTGREEN); + + primaryStage.setTitle("A JavaFX Program"); + primaryStage.setScene(scene); + primaryStage.show(); + } + + //-------------------------------------------------------------------- + // Launches the JavaFX application. This method is not required + // in IDEs that launch JavaFX applications automatically. + //-------------------------------------------------------------------- + public static void main(String[] args) + { + launch(args); + } +} \ No newline at end of file