public Point getPreferredLocation() { Rectangle maxBounds = GUI.getMaxWindowBounds(); int ijX = Prefs.getInt(IJ_X, -99); int ijY = Prefs.getInt(IJ_Y, -99); if (ijX >= maxBounds.x && ijY >= maxBounds.y && ijX < (maxBounds.x + maxBounds.width - 75)) return new Point(ijX, ijY); Dimension tbsize = toolbar.getPreferredSize(); int ijWidth = tbsize.width + 10; double percent = maxBounds.width > 832 ? 0.8 : 0.9; ijX = (int) (percent * (maxBounds.width - ijWidth)); if (ijX < 10) ijX = 10; return new Point(ijX, maxBounds.y); }
public Point getPreferredLocation() { if (!IJ.isJava14()) return new Point(0, 0); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); Rectangle maxBounds = ge.getMaximumWindowBounds(); int ijX = Prefs.getInt(IJ_X, -99); int ijY = Prefs.getInt(IJ_Y, -99); if (ijX >= 0 && ijY > 0 && ijX < (maxBounds.x + maxBounds.width - 75)) return new Point(ijX, ijY); Dimension tbsize = toolbar.getPreferredSize(); int ijWidth = tbsize.width + 10; double percent = maxBounds.width > 832 ? 0.8 : 0.9; ijX = (int) (percent * (maxBounds.width - ijWidth)); if (ijX < 10) ijX = 10; return new Point(ijX, maxBounds.y); }