Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4487771

Window.setLocationRelativeTo() doesn't center Windows correctly

XMLWordPrintable

    • generic
    • generic

      From inspecting the code, it looks as if there are a number of problems with the way Window.setLocationRelativeTo() centers a Window (i.e. when Component is null):

      * it should retrieve the screen bounds using Window.getGraphicsConfiguration().getBounds(), which will return the bounds of the screen the Window is on, rather than the primary screen
      (and)
      * it should account for the screen insets using the new 1.4 Toolkit.getScreenInsets() to account for the screen inets
      (or alternatively)
      * it should use the new 1.4 GraphicsEnvironment.getCenterPoint() and getMaximumWindowBounds() methods, which should take care of most of the calculations.

            art Artem Ananiev (Inactive)
            bchristi Brent Christian
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: