r/JavaFX • u/TheCodingFella • Jul 18 '23
Tutorial JavaFX Preferences: Saving and Retrieving User Preferences
The main focus of this article is to save and restore the window size and position of a JavaFX application. We will achieve this by using the JavaFX Preferences API to store the window dimensions and coordinates and then retrieve them the next time the application is launched. This ensures that the window will appear exactly where and with the size the user had it during the last session.
🔗 JavaFX Preferences: Saving and Retrieving User Preferences
11
Upvotes
View all comments
Show parent comment
2
u/Commercial_Gate193 Jul 19 '23
com.iamsoft.util.ui.javafx.prefs makes this easier.
StagePrefUtil.manage(stage, Main.class)handles x, y, width and height attributes in one line and also accommodates screen resolution changes.