После того как я ввел ResumesPaneFxmlController resumesPaneController в MainMenuFxmlController, я не могу понять, почему ... объекты resumesPaneController и resumesPane равны нулю.
MainMenu.f xml:
...
<TabPane tabClosingPolicy="UNAVAILABLE" VBox.vgrow="ALWAYS">
<tabs>
<Tab text="Резюме">
<content>
<fx:include id="resumesPane" source="ResumesPane.fxml" />
</content>
</Tab>
<Tab text="Вакансии">
<content>
<fx:include id="vacanciesPane" source="VacanciesPane.fxml" />
</content>
</Tab>
</tabs>
</TabPane>
...
ResumePane.f xml:
<StackPane xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:id="backgroundImagePane"
fx:controller="ru.iworking.personnel.reserve.controller.ResumesPaneFxmlController">
...
</StackPane>
MainMenuFxmlController:
public class MainMenuFxmlController implements Initializable {
private static final Logger logger = LogManager.getLogger(MainMenuFxmlController.class);
@FXML private Parent resumesPane; //not used in this demo
/*
* Get a reference to ResumesPane controller simply by appending
* the word Controller in addition to the variable name of the embedded
* element:$IncludedView;+Controller
*/
@FXML private ResumesPaneFxmlController resumesPaneController;
....
public void show(Parent root) {
Stage stage = MainApp.PARENT_STAGE;
stage.setTitle("Personnel reserve");
AppUtil.setIcon(stage);
Scene scene = new Scene(root);
addStylesheets(scene);
stage.setScene(scene);
stage.show();
}
...
}
ResumesPaneFxmlController:
public class ResumesPaneFxmlController implements Initializable {
private static final Logger logger = LogManager.getLogger(ResumesPaneFxmlController.class);
....
}
MainApp:
...
FXMLLoader fxmlLoader = new
FXMLLoader(getClass().getResource("/fxml/MainMenu.fxml"));
Parent parent = fxmlLoader.load();
MainMenuFxmlController mainMenuController = fxmlLoader.getController();
mainMenuController.show(parent);
...
Что я могу сделать не так?