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