The java.util.prefs were introduced in Java 1.4. This package is used to write/read files about your application. Such as saving the window's previous location or the size of the window.
I would recommend, every time a user triggers an event, I would record the information.
Here a link to help you get started:
http://javaalmanac.com/egs/java.util.prefs/pkg.html