查看JavaFX SceneBuilder時,它可以加載任何類型的fxml。根節點或控制器被忽略。場景構建器能夠加載任何類型的fxml並可以顯示其組件。JavaFX 8加載外部FXML
有沒有人幻想加載一個fxml的方式,直接指向它的字段的id,控制器或根節點的類型?
問題是,當我嘗試加載任何fxml時,它只能加載,如果我設置正確的根類型。我想加載(通過FileChooser)我可以找到的任何FXML(讓我們說)一個窗格。
任何想法將不勝感激(www中的所有幫助都指向使用特定根類型的加載機制,因此根類型是已知的)。我想加載未知根類型不顧外匯:身份證的等
例外:
Exception in Application start method
Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$152(LauncherImpl.java:182)
at com.sun.javafx.application.LauncherImpl$$Lambda$2/1531448569.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: javafx.fxml.LoadException:
/C:/Users/Dominik/Documents/fhnw/bath/svn/examples/fxmlloader/out/production/FxHeatMap/eu/hansolo/fx/heatmap/fxmlload/Application.fxml:20
at eu.hansolo.fx.heatmap.fxmlload.FXMLLoader.start(FXMLLoader.java:34)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$159(LauncherImpl.java:863)
at com.sun.javafx.application.LauncherImpl$$Lambda$66/84373524.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$172(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl$$Lambda$47/1537074899.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$null$170(PlatformImpl.java:295)
at com.sun.javafx.application.PlatformImpl$$Lambda$50/1947223685.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$171(PlatformImpl.java:294)
at com.sun.javafx.application.PlatformImpl$$Lambda$48/835743810.run(Unknown Source)
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$145(WinApplication.java:101)
at com.sun.glass.ui.win.WinApplication$$Lambda$38/1962582134.run(Unknown Source)
... 1 more
Caused by: javafx.fxml.LoadException:
/C:/Users/Dominik/Documents/fhnw/bath/svn/examples/fxmlloader/out/production/FxHeatMap/eu/hansolo/fx/heatmap/fxmlload/Application.fxml:20
at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2605)
at javafx.fxml.FXMLLoader.access$700(FXMLLoader.java:104)
at javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:918)
at javafx.fxml.FXMLLoader$InstanceDeclarationElement.processAttribute(FXMLLoader.java:967)
at javafx.fxml.FXMLLoader$Element.processStartElement(FXMLLoader.java:216)
at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:740)
at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2711)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2531)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2445)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3218)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3179)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3152)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3128)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3108)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3101)
at eu.hansolo.fx.heatmap.fxmlload.FXMLLoader.start(FXMLLoader.java:32)
... 14 more
Caused by: java.lang.ClassNotFoundException: sample.MainController
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:916)
... 27 more
Process finished with exit code 1
當您嘗試加載時是否存在任何異常? –
一堆,首先將是:https://gist.github.com/e4bb54d56efe2d8d5cd4 – m4mbax