简体   繁体   中英

JavaFx Communicating between controllers

I am trying to send data from one controller to another and I decide to inherit the scene class with one of my controller so when I create the second scene I can pass it through an overloaded constructor that was extended.

Is it correct for a controller class to inherit Scene class?

Otherwise please suggest a more efficient way to communicate between controllers.

Controller class should be separated from gui class. In mvc pattern there are three layers: model, controller and view.

View - gui class that extends Scene or other ui component.

Controller - listener class that catches events made by user

Model - holds data of program. Like username,password

You can also create separate classes to perform operations(add,subtract) of data in model

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM