-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHelloJavaFX.java
40 lines (35 loc) · 1.45 KB
/
HelloJavaFX.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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);
}
}