سؤال

Current setup is: One main stage object--A (with GUI from FXML) and buttons. Clicking buttons on the main stage object will create objects from another class --B. B objects have different GUI FXML. In this case, is it best to create B objects each with its unique controller? Or do drive them by one controller?

هل كانت مفيدة؟

المحلول

I suggest to divide your GUI into some logical custom controls using the fx:root construct.

1 FXML -> 1 root/ controller

Here's the tutorial: http://docs.oracle.com/javafx/2/fxml_get_started/custom_control.htm#BABDAAHE

نصائح أخرى

I think the best practice is to have 1 controller for each FXML file. The DataFX framework provides a flow API in the newest version (2b07 - Release 2.0 will follow in a few weeks) that do exactly what you need: http://www.javafxdata.org/overview_flow.html

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top