1
如何在FXML - scenebuilder中调用接口默认方法。SceneBuilder中的JavaFX调用默认方法(FXML)
我有这样一个接口:
public interface Startable
{
default void handleStart(){...}
}
,并像一个控制器:
BlaController implements Startable {...}
但如果我调用该方法 “handleStart()” 中的FXML,我得到下面的异常:
javafx.fxml.LoadException: Error resolving onMouseClicked='#handleStart', either the event handler is not in the Namespace or there is an error in the script.
是否有可能调用该方法?
你的控制器可以实现'''javafx.fxml.Initializable''',并实现预期的结果,为什么你需要一个自定义接口? –
无论如何,控制器正在实现Initializable以便能够使用资源包,但是我看不出这应该如何帮助我? – Punika