找不到JavaFX控制器方法 [英] JavaFX Controller Method Not Found

查看:126
本文介绍了找不到JavaFX控制器方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几周前,在学习了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.

推荐答案

此外,当我尝试这样做时,它还会向我发出警告:参数'event' 无法分配给javafx.event.Event"

Also, when I try to do so, it gives me a warning: "Parameter 'event' is not assignable to javafx.event.Event"

所以,这是您的问题.您的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控制器方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆