I am trying to open a new form window. But I want to assign some values in the constructor.
Codes I tried:
fxmlLoader.setRoot(null);
fx: root (DbForm.fxml)
Error:
The controller value is already specified. File: / 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());
}
source
share