There is an Addlist controller. It is called from the main window and adds a new Tab to the TabPane controller of another class: ManageLists . How to understand when to transfer the tab itself to another controller and how to do it?
Addlist:
btnCreateList.setOnAction(t -> { if (!tfdListName.getText().isEmpty()) { listName = tfdListName.getText(); Tab tab = new Tab(); tab.setText(listName); /* Как передать tab */ } else { alertStart(); } }); ManageLists:
@FXML TabPane tabPane; @Override public void initialize(URL location, ResourceBundle resources) { /* Как услышать изменение в Addlist и словить tab, передав его в tabPane */ }