Saving UI in fxml: javafx

I have a javafx application that allows the user to add as much as he needs.

I am loading the main root of the scene from a file fxml

that contains the UI default.

When the user changes the interface, I change the scene using annotation @FXML

.

These changes are temporary and the user interface will be the same as the next time the application is launched. So here's my question:

How do I save changes made to the application interface at runtime to a new fxml

file?

+3


source to share


1 answer


An FXML file is an XML file that you can write with any XML Libary.

But I would recommend saving the buttons in json or properties file and adding them back to Code.



So, if applications stop saving buttons to a file, and if applications start adding them to the scene again, it is much easier than saving them to an FXML file.

But if you really want to do it FXML take a look at https://bitbucket.org/gluon-oss/scenebuilder maybe you can use some of the code from SceneBuilder to save your scene as FXML.

+2


source







All Articles