最近写了一个javafx的小工具。其中也遇到了一些问题,这里做个记录备忘。
1、如何动态切换fxml文件?
private Node replaceSceneContent(String fxml) throws Exception {
FXMLLoader loader = new FXMLLoader();
InputStream in = Main.class.getResourceAsStream(fxml);
loader.setBuilderFactory(new JavaFXBuilderFactory());
loader.setLocation(Main.class.getResource(fxml));
AnchorPane page;
tr