
com.panayotis.hrgui.HiResPreferences Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hrgui Show documentation
Show all versions of hrgui Show documentation
High Resolution HiDPI friendly Swing based user interface
The newest version!
package com.panayotis.hrgui;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
public interface HiResPreferences {
default float scaleFactor() {
return -1;
}
default boolean storePrefs(float scaleFactor) {
return false;
}
static HiResPreferences getDefault() {
try (InputStream istream = HiResPreferences.class.getResourceAsStream("hires.resource")) {
if (istream != null) {
String line = new BufferedReader(new InputStreamReader(istream)).readLine();
if (line != null) {
return (HiResPreferences) Class.forName(line.trim()).newInstance();
}
}
} catch (Exception exception) {
System.err.println("Unable to load HiRes preferences: " + exception);
}
// Couldn't find any preferences definition
return new HiResPreferences() {
};
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy