小编Öme*_*lik的帖子

JavaFX错误:已指定控制器值

我正在尝试打开一个新的窗体窗口。但是我想在构造函数中分配一些值。

我试过的代码:

fxmlLoader.setRoot(null);
Run Code Online (Sandbox Code Playgroud)

fx:root(DbForm.fxml)

错误:

已指定控制器值。文件:/ C:/Users/Admin/Documents/NetBeansProjects/SeleniumWebTest/dist/run685287776/SeleniumWebTest.jar!/seleniumwebtest/DbForm.fxml:14

try {

     DbFormController dbYapCont = new DbFormController("s", "s", "s", "s");
     FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("DbForm.fxml"));

     fxmlLoader.setController(dbYapCont);
     Pane root = (Pane) fxmlLoader.load();
     Stage stage = new Stage();
     stage.setScene(new Scene(root));
     stage.show();
     } catch (Exception e) {
                System.out.println(e.getMessage());
            }
Run Code Online (Sandbox Code Playgroud)

javafx

2
推荐指数
1
解决办法
1863
查看次数

标签 统计

javafx ×1