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 Calculator extends Application { @Override public void start(Stage primaryStage) throws IOException { // 加载FXML文件 FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/CalculatorView.fxml")); Parent root = fxmlLoader.load(); Scene scene = new Scene(root, 600, 500); primaryStage.setTitle("计算器"); primaryStage.setScene(scene); primaryStage.show(); } public static void main(String[] args) { launch(args); } }