javafx - Nested controller issue in Java FX -


i'm trying include controller(selectedissuecontroller) in main layout (main.fxml). following error:

can not set lt.mypackage.controllers.selectedissuecontroller field lt.mypackage.controllers.maincontroller.selectedissuecontroller javafx.scene.layout.vbox 

line in main.fxml:

  <fx:include fx:id="selectedissuecontroller" source="controllers/selectedissue.fxml" /> 

my selectedissue.fxml:

<vbox xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="lt.mypackage.controllers.selectedissuecontroller" fillwidth="false" splitpane.resizablewithparent="false">     <children>      .....      .....     </children> </vbox> 

line in maincontroller:

@fxml private selectedissuecontroller selectedissuecontroller; 

as understand injects vbox object now, need selectedissuecontroller. wrong current implementation?

the fxmlloader appends controller fx:id specified in fx:include element name of field inject controller to. therefore should either:

@fxml private selectedissuecontroller selectedissuecontrollercontroller; 

or

<fx:include fx:id="selectedissue" source="controllers/selectedissue.fxml" /> 

the value injected field without controller suffix value created fx:include, i.e. object created root of included fxml.

see nested controllers on stackoverflow doc


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -