FXML を使用するための TornadoFX ガイド ( https://github.com/edvin/tornadofx/wiki/FXML ) に従っていますが、エラーが発生しています:
java.lang.IllegalArgumentException: FXML not found for class ui.view.BoardView
ここに私の BoardView.kt ビューがあります:
class BoardView : View() {
override val root: BorderPane by fxml()
val hello: Label by fxid()
init {
hello.text = "Hello World"
}
}
そして、これがFXMLファイルです(同じパッケージのui.viewにあります)*
<BorderPane xmlns="http://javafx.com/javafx/null" xmlns:fx="http://javafx.com/fxml/1">
<padding>
<Insets top="20" right="20" bottom="20" left="20" />
</padding>
<center>
<HBox alignment="CENTER" spacing="10">
<Label fx:id="hello">
<font>
<Font size="20"/>
</font>
</Label>
</HBox>
</center>
</BorderPane>
役立つ場合は、完全なスタック トレースを次に示します。
java.lang.IllegalArgumentException: FXML not found for class ui.view.BoardView
at tornadofx.UIComponent$fxml$1.<init>(Component.kt:360)
at tornadofx.UIComponent.fxml(Component.kt:353)
at tornadofx.UIComponent.fxml$default(Component.kt:353)
at ui.view.BoardView.<init>(BoardView.kt:12)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at java.lang.Class.newInstance(Class.java:442)
at tornadofx.FXKt.find(FX.kt:238)
at tornadofx.App.start(App.kt:29)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$163(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$176(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$174(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$175(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$149(WinApplication.java:191)
at java.lang.Thread.run(Thread.java:745)
「BoardView」から「BoardView.fxml」まで、fxml() に引数を与えて、fxml ファイルを src/main/resources に移動しようとしました。Component.kt のソース ファイルを見ても、明らかなことは何もわかりませんでした。
あなたが私に与えることができるどんな助けにも感謝します.