我正在尝试从子文件夹加载fxml,但它失败了.我有替换场景内容的行:
private Parent replaceSceneContent(String fxml) throws Exception {
Parent page = (Parent) FXMLLoader.load(App.class.getResource("skinFolder/fxml/"+fxml), null, new JavaFXBuilderFactory());
Scene scene = stage.getScene();
if (scene == null) {
scene = new Scene(page, 700, 450);
scene.getStylesheets().add(App.class.getResource("skinFolder/css/defaultSkin.css").toExternalForm());
stage.setScene(scene);
} else {
stage.getScene().setRoot(page);
}
stage.sizeToScene();
return page;
}
Run Code Online (Sandbox Code Playgroud)
我在下一个方法中使用此函数:
private void gotoLogin() {
try {
replaceSceneContent("login.fxml");
} catch (Exception ex) {
Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
}
}
Run Code Online (Sandbox Code Playgroud)
问题是我得到了下一个错误:
javafx.fxml.LoadException: Method processLogin() does not have the correct signature for an event handler.
at javafx.fxml.FXMLLoader$Element.processEventHandlerAttributes(Unknown Source)
at javafx.fxml.FXMLLoader$ValueElement.processEndElement(Unknown Source) …Run Code Online (Sandbox Code Playgroud) 我想知道是否有人知道或知道我可以学习的链接,或者看看如何使用JavaFX 2.0中的fxml文件创建按钮,单选按钮,滚动条等的外观.
我有这个学校的作业,我希望它建立得很好,所以我尝试做一切像公司应用程序,用于按钮和其他元素的皮肤.
我真的很感激任何帮助.
[编辑]大家好,已经有一段时间了,我现在对JavaFX了解得更多,现在当我回头看时,我看到它听起来有多愚蠢,请原谅我的不尊重和糟糕的详细问题.无论如何stackoverflow确保我永远不会再问任何问题.