0
我的代码编译,但我有空的窗口。我认为FXML加载不是很好。感谢帮助!空窗口JavaFX
package application;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class Main extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
try{
StackPane stackPane = new StackPane();
FXMLLoader loader = new FXMLLoader();
loader.setLocation(Main.class.getResource("/StackPaneWindow.fxml"));
Scene scene = new Scene(stackPane);
primaryStage.setTitle("Hello World!");
primaryStage.setScene(scene);
primaryStage.show();
} catch (Exception e) {
e.printStackTrace();
}
}
}
StackPaneWindows.fxml只有按钮。我不能粘贴。
兄弟!你真棒! – Brade