添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
i started learning JavaFX , and watched a tutorial.
When i click the button it shows me these errors , and i have no idea how to fix this.

Main.java



MainItemsController.java



MainItems.fxml


ElectricalDep.fxml


OUTPUT:
I suspect that the error is caused because it can't load the FXML file.  Try using this template for loading FXML:


MainItemsController.java


OUTPUT:


if i change line 20 in MainItemsController.java
from:

to


the output changes to:


Can't do video tutorials I'm afraid, but your issue is that certain things are not wired up for whatever reason.
In the first case it's because (as you show) main has not been instantiated.
In the second it's because mainLayout has not been instantiated.

Whether there's an annotation missing, or something around construction of the objects I can't say.
Dave Tolls wrote: Can't do video tutorials I'm afraid, but your issue is that certain things are not wired up for whatever reason.
In the first case it's because (as you show) main has not been instantiated.
In the second it's because mainLayout has not been instantiated.

Whether there's an annotation missing, or something around construction of the objects I can't say.



I instantiated both of them but still the same.