How to pass object created in FXML Controller1 to Controller2 of inner FXML control

后端 未结 2 586
时光取名叫无心
时光取名叫无心 2020-11-28 08:26

I have a JavaFX 2.0 application, which consists of two FXML files, and two controllers for them + one "main" .java file.

At the start time, FXML1 is initial

2条回答
  •  长情又很酷
    2020-11-28 09:00

    i'm using 1.7.0_21, it can now code like this: in main app fxml file ,

    
          
    
    

    and the included fxml can defind it's own fxml file , like this :

    
    

    and then , in the main application contoller require the "Tom.fxml" 's controller like this :

     @FXML private TomController tomController;
    

    notice the "@FXML" . maybe it invoke the contoller automatic.

提交回复
热议问题