I'm very new to this topic and trying to gain some understanding. I'm writing an application that allows user to personalize it and create his/own preferences, such as font color, size, certain nodes' positions and etc. While doing my research, I found couple examples using xml files to store users' perferenace.
Is this the best way to store information? Is there a more secure way to do it? since xml file is readable for people and not just the machine.
If you need to save more user informations, you can use a database.
But if you need to save one user information, you can use Preferences :
Preferences pref;
pref = Preferences.userNodeForPackage(yourClass.class);
pref.put("yourPreferenceName","yourPreferenceValue");
//This create a String preference if it not exists or modify the value if
//exists
Preferences pref;
pref = Preferences.userNodeForPackage(yourClass.class);
String preference = pref.get("yourPreferenceName","yourPreferenceValue");
//This give you the value of the preference
If you want to know more about the preferences go here.
来源:https://stackoverflow.com/questions/49721212/save-application-setting-in-java-javafx