Java vs JavaFX Script vs FXML. What better way to program JavaFX?
I'm a novice in JavaFX. I met 2-3 ways to design UI in JavaFX
>Simple java file, the same as the method we use in swing > JavaFX script I don't know > fxml is an XML based UI design file
Which is better? Why?
Solution
Just to illustrate, JavaFX scripts were used before JavaFX 2.0 and are no longer used!
>You can use this method if you are more familiar with the coded UI in Java However, I personally don't like this method, because when your application is too complex, it will complicate the code. > JavaFX script was used before JavaFX 2.0 and is no longer used > fxml based UI design was introduced in JavaFX 2.0 These help programmers code JavaFX applications using MVC methods You can find a very good fxml introduction here
A section from Oracle docs, why use fxml
Fxml can be easily designed using scene builder, which is the drag n drop UI Designer for JavaFX applications Using fxml has the following advantages:
>Your application follows the MVC structure, just like enterprise Java EE applications. > The presentation layer (UI) is isolated from the application layer (logic), so that the appearance of the application can be easily changed when needed, just like a website! > Fxml brings extensibility and maintainability to your application
My suggestion to you is to use fxml If you don't understand them, please understand them It will be worth it!