-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHelloFX.java
More file actions
37 lines (30 loc) · 895 Bytes
/
HelloFX.java
File metadata and controls
37 lines (30 loc) · 895 Bytes
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
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.HBox;
import javafx.scene.control.Label;
/** * A JavaFX Hello World application */
public class HelloFX extends Application
{
public static void main(String[] args)
{
// Launch the application.
launch(args);
}
@Override
public void start(Stage primaryStage)
{
// Create a Label component.
Label messageLabel = new Label("Hello World");
// Put the Label in an HBox.
HBox hbox = new HBox(messageLabel);
// Create a Scene with the HBox as its root node.
Scene scene = new Scene(hbox);
// Add the Scene to the Stage.
primaryStage.setScene(scene);
// Set the stage title.
primaryStage.setTitle("My First Scene");
// Show the window.
primaryStage.show();
}
}