If you google JavaFX Tutorial, the search engine will give you a bunch of lessons on how to program in JavaFX. But almost all programs are written at the expense of classes. But you can still use fxml, isn't that better? What are the pros and cons of each approach?
- Using classes or creating fxml forms with controllers for them is not “better or worse”, but “as more convenient in the current situation”. We need to quickly build a prototype of the interface - take Scene Builder (Gluon) and throw it in. You need to quickly make the basic functionality without worrying about the design of the GUI - we throw in classes. Later still have to bring to mind. - DimXenon
- And how to bring to mind? Using fxml or classes? - faoxis
- Again - as convenient. - DimXenon 2:41 pm
- But what about the MVC model? Don't you need to use fxml for it? - faoxis 2:55 pm
- It is possible and recommended to use fxml for it. But this does not mean that it is impossible to assemble MVC without fxml-forms and controllers for them. - DimXenon 2:57 pm
|
1 answer
Less code in the controller - the only one advantage. For example:
<ComboBox fx:id="url" layoutX="397.0" layoutY="62.0" onAction="#startCombo" prefHeight="25.0" prefWidth="149.0"> <items> <FXCollections fx:factory="observableArrayList"> <String fx:value="http://wwww.site.com" /> <String fx:value="http://wwww.site.com/" /> <String fx:value="http://wwww.site.com" /> <String fx:value="http://wwww.site.com" /> <String fx:value="http://wwww.site.com" /> <String fx:value="http://wwww.site.com" /> </FXCollections> </items> </ComboBox> it's all in fxml, there’s actually no difference, write whatever you want
- I will repeat my comment above. Wouldn't writing a GUI without fxml make it difficult to build an MVC model? - faoxis
|