问题描述
几周前,在学习了Java的基础知识之后,我找到了JavaFX.我认为这非常有用,因为我不喜欢使用JFrame制作应用程序.在我看来,它是如此有限和复杂.
A few weeks ago, after having learnt the basics of Java, I found JavaFX. I thought it'd be very useful, as simply, I dislike making applications using JFrame. It's just so limited and complicated in my opinion.
我正在使用SceneBuilder制作.fxml文件,并且正在Eclipse中对实际内容进行编码.在SceneBuilder中编辑文件后,请确保重新加载该项目,并在进行更改后偶尔测试该程序.
I'm making the .fxml files using SceneBuilder, and I'm coding the actual thing in Eclipse. I make sure to reload the project after I edit a file in SceneBuilder, and I occasionally test the program after I make changes.
我遇到了以下错误: http://pastebin.com/n99ccdiB
I've run into the following error:http://pastebin.com/n99ccdiB
我的控制器类(在正确的位置..): http://pastebin.com/LfhWbP70
My Controller Class (in the proper location..):http://pastebin.com/LfhWbP70
我的.fxml文件:http://pastebin.com/YsV8EkcD
My .fxml File:http:// pastebin.com/YsV8EkcD
有人知道如何解决此问题吗?这是唯一给我带来错误的东西,这非常令人沮丧..请注意,WindowHandler和DatabaseHandler类中没有错误,并且它们可以与其他东西一起正常工作.
Does anyone know how to fix this? It's the only thing giving me an error, and it's quite frustrating.. Note that there are no mistakes in the WindowHandler and DatabaseHandler classes, and they work fine with other things.
推荐答案
所以,这是您的问题.您的Controller导入错误:您拥有java.awt.event.ActionEvent而不是JavaFX ActionEvent.
So, there's your problem. You have the wrong import in your Controller: you have the java.awt.event.ActionEvent instead of the JavaFX ActionEvent.
这篇关于找不到JavaFX控制器方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!