I am now trying to use Preference class using
Preferences pfrOfThis = Preferences.userNodeForPackage(this)
It gets an error:
“method userNodeForPackage in class java.util.prefs.Preferences cannot be applied to given types;
required: java.lang.Class
found: myPac.MainApp
reason: actual argument myPac.MainApp cannot be converted to java.lang.Class by method invocation conversion
Leaking this in constructor”
MainApp here extends JFrame. How comes it is not a Class and could not be used here?
The reference “this” is to an object. Try “this.getClass()”.