I have modified the structure to create a simple example of the problem I am facing, which can be easily reproduced. I am attempting to combine two custom components - one is a custom button and the other is an hbox that contains the custom button.
The Java code and its corresponding fxml for the custom button are as follows:
public class Custom_Button extends Button { public Custom_Button() { super(); try{ FXMLLoader loader=new FXMLLoader(getClass().getResource("/eu/mylib/libraries_custom_/custom_button/Custom_Button.fxml")); loader.setRoot(this); loader.setController(this); loader.load(); }catch (Exception e){ e.printStackTrace(); } } } FXML :
now the second component :
java code:
public class Custom_Pick extends HBox { public Custom_Pick() { super(); try{ FXMLLoader loader=new FXMLLoader(getClass().getResource("/eu/mylib/libraries_custom_/custom_pick/Custom_Pick.fxml")); loader.setRoot(this); loader.setController(this); loader.load(); }catch (Exception e){ e.printStackTrace(); } } } FXML :
I'll try to explain this as best as I can. Both components seem to work fine when I launch an app that contains them. However, my main issue is with Scene Builder. The first component is displayed correctly, which means it has a visual representation in Scene Builder. But the second component, which contains the first component, only displays a blank pane, and I'm not sure why.
IMAGES :



project structure :

Источник: https://stackoverflow.com/questions/780 ... nts-javafx
Мобильная версия