我有一个javaFx按钮,我需要在单击时调用一个JFrame (swing),我尝试了这段代码,但是javaFx场景构建器上没有出现这种方法
@FXML
private Button button;
public void afficheGraph(String sys) throws Exception{
graph frm = new graph(id);//the swing JFrame
frm.setVisible(true);
}我犯了这个错误
由: javafx.fxml.LoadException: Error解析onAction='#afficheGraph‘引起,要么事件处理程序不在名称空间,要么脚本中出现错误。
发布于 2016-12-15 22:13:42
如果我没有弄错,错误来自方法本身及其参数,我认为您需要添加一个注释@FXML,以便对该方法进行计数,并且我看不到添加String sys参数的理由或可抛出的参数。下面是一个替代:
@FXML
public void afficheGraph(ActionEvent ae){ //ActionEvent instead of String
graph frm = new graph(id);//the swing JFrame
frm.setVisible(true);
}我在掷球上可能是错的,但我看不到兴趣,祝你好运!
https://stackoverflow.com/questions/41171809
复制相似问题