How to “correctly” detect DPI of display with Java?
问题 I have the following app that draws a rule : public class Rule extends JComponent { public static final long serialVersionUID=26362862L; // public static final int INCH=Toolkit.getDefaultToolkit().getScreenResolution(); public static final int INCH=(int)(Toolkit.getDefaultToolkit().getScreenResolution()*1.15); // Auto adjust this 1.15 ? public static final int HORIZONTAL=0; public static final int VERTICAL=1; public static final int SIZE=35; public int orientation; public boolean isMetric;