I have a Java Swing application with the following class:
public class ResolutionHandler {
public static int calcSizeForResolution(int originalSize) {
return (int) Math.round(originalSize * ((double) Toolkit.getDefaultToolkit().getScreenResolution()) / 96.0);
}
}
Do I need to set each component's size via invoking this method, or would there be a simpler method to guarantee that when a component's size (be it height, width, row height, font size or any other dimension) is explicitly declared, the size value would be normalized according to the actual screen resolution?