Search code examples
javajavafx-2javafxfxml

Multiple controller for one FXML file


I have one fxml file controlled by one controller. I want to separate the controller into multiple parts as if placed in one controller makes a long code. Unfortunately, fx:controller can only be placed in the root. Are there any suggestions for me how to separate the controller?


Solution

  • I recommend to create custom controls - use several smaller FXML files rather than one big FXML file.

    Here is the tutorial:

    http://docs.oracle.com/javafx/2/fxml_get_started/custom_control.htm