-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainApp.java
More file actions
34 lines (24 loc) · 738 Bytes
/
Copy pathMainApp.java
File metadata and controls
34 lines (24 loc) · 738 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
package com.image;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import java.io.IOException;
public class MainApp extends Application {
@Override
public void start(Stage stage) throws IOException {
try {
// 加载 FXML 文件并设置界面
Parent root = FXMLLoader.load(getClass().getResource("/Main.fxml"));
stage.setTitle("My Application");
stage.setScene(new Scene(root));
stage.show();
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
launch(args);
}
}