You may be wondering, why use FXML? Let’s talk about some of the benefits of using FXML. A benefit of FXML is that you can change the user interface at any time without changing the underlying logic.
FXML is an XML based language that provides the structure for building a user interface separate from the application logic of your code. The FXML source code is not compiled, so it can be changed and loaded at run time.
This feature enables developers to do rapid prototyping since changes do not have to be recompiled each time. It is easy for the development team to create and maintain a testable user interface. Another benefit of FXML is how closely it maps directly to Java.
So you can use the Java API documentation to understand what elements and attributes are allowed. In general, most Java FX classes can be used as elements.
And if you’re familiar with the enterprise Beans, Bean properties can be used as attributes. These are just a few of the benefits of using FXML.