/** * Returns the Point where Windows should be centered. It is recommended that centered Windows be * checked to ensure they fit within the available display area using getMaximumWindowBounds(). * * @return the point where Windows should be centered * @exception HeadlessException if isHeadless() returns true * @see #getMaximumWindowBounds * @since 1.4 */ public Point getCenterPoint() throws HeadlessException { // Default implementation: return the center of the usable bounds of the // default screen device. Rectangle usableBounds = SunGraphicsEnvironment.getUsableBounds(getDefaultScreenDevice()); return new Point( (usableBounds.width / 2) + usableBounds.x, (usableBounds.height / 2) + usableBounds.y); }
private void deactivateDisplayListener() { final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); ((SunGraphicsEnvironment) ge).removeDisplayChangedListener(this); }
/** * Returns the maximum bounds for centered Windows. These bounds account for objects in the native * windowing system such as task bars and menu bars. The returned bounds will reside on a single * display with one exception: on multi-screen systems where Windows should be centered across all * displays, this method returns the bounds of the entire display area. * * <p>To get the usable bounds of a single display, use <code>GraphicsConfiguration.getBounds() * </code> and <code>Toolkit.getScreenInsets()</code>. * * @return the maximum bounds for centered Windows * @exception HeadlessException if isHeadless() returns true * @see #getCenterPoint * @see GraphicsConfiguration#getBounds * @see Toolkit#getScreenInsets * @since 1.4 */ public Rectangle getMaximumWindowBounds() throws HeadlessException { // Default implementation: return the usable bounds of the default screen // device. This is correct for Microsoft Windows and non-Xinerama X11. return SunGraphicsEnvironment.getUsableBounds(getDefaultScreenDevice()); }