Can't import custom components with custom cell factories

♀尐吖头ヾ 提交于 2019-11-29 13:04:43

It seems the issue lies within the scenebuilder class loading environment. It is also a known bug / issue with scenebuilder.

A workaround is to propogate the classloader to the FXML loader.

try {
    FXMLLoader loader = new FXMLLoader(getClass().getResource("CustomComponent.fxml"));
    loader.setRoot(this);
    loader.setController(this);
    loader.setClassLoader(getClass().getClassLoader());
    loader.load();
} catch (IOException e ){
    throw new RuntimeException(e);
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!