-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHelloFX.java
More file actions
32 lines (25 loc) · 837 Bytes
/
HelloFX.java
File metadata and controls
32 lines (25 loc) · 837 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
package com.example;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class HelloFX extends Application {
@Override
public void start(Stage stage) throws Exception {
// Ladda FXML
FXMLLoader fxmlLoader = new FXMLLoader(HelloFX.class.getResource("hello-view.fxml"));
Parent root = fxmlLoader.load();
// Skapa scenen
Scene scene = new Scene(root, 640, 480);
// Koppla in CSS-styling
scene.getStylesheets().add(HelloFX.class.getResource("style.css").toExternalForm());
// Sätt titel
stage.setTitle("Java Chat");
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch();
}
}