-1
当我把方法“openPlanes”放入按钮的选项“onAction”。 这显示了很多错误。 但是,如果我删除“openPlanes”他的开放正常。无法在JavaFX中打开一个新窗口
@FXML
private void openPlanes() {
openStage("view/Cadastro.fxml");
}
private void openStage(String fxml) {
try {
Stage currentStage = (Stage) PLANE.getScene().getWindow();
Parent root = FXMLLoader.load(getClass().getResource(fxml));
Scene scene = new Scene(root);
Stage stage = new Stage(StageStyle.TRANSPARENT);
stage.setScene(scene);
stage.show();
currentStage.hide();
} catch (IOException ex) {
Logger.getLogger(mainController.class.getName()).log(Level.SEVERE, null, ex);
}
}
引起:javafx.fxml.LoadException:未指定控制器。 文件:/ C:/Users/diego/Documents/NetBeansProjects/Automekanik/DGDSoft/dist/run708547813/DGD%20Soft.jar /dgdsoft/view/MainDGD.fxml:23
at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2597)
at javafx.fxml.FXMLLoader.access$100(FXMLLoader.java:103)
at javafx.fxml.FXMLLoader$Element.getControllerMethodHandle(FXMLLoader.java:557)
at javafx.fxml.FXMLLoader$Element.processEventHandlerAttributes(FXMLLoader.java:599)
at javafx.fxml.FXMLLoader$ValueElement.processEndElement(FXMLLoader.java:770)
at javafx.fxml.FXMLLoader.processEndElement(FXMLLoader.java:2823)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2532)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3214)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)
at dgdsoft.DGDSoft.start(DGDSoft.java:19)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
... 1 more
异常运行的应用程序dgdsoft .DGDSoft Java结果:1
有什么错误?什么是'openStage(...)'? –
我分析这家伙的应用 GitHub的 - https://github.com/mlayah/bookingFX/tree/master/src/bookingfx YouTube的 - https://www.youtube.com/watch?v=ooT0Ueyngeo 我做了一些平等的部分来学习更多,我试图修改一些。 现在我试图调用第二个窗口,但我不明白这个错误,并且这个代码 –
“没有指定控制器”意味着你没有在你的FXML文件中指定控制器类。 –