GraphicsEnvironment.getMaximumWindowBounds() returns wrong horizontal size in dual screen environment

Bug #1171563 reported by Thue Janus Kristensen
24
This bug affects 5 people
Affects Status Importance Assigned to Milestone
JOSM
Unknown
Critical
openjdk-7 (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

GraphicsEnvironment.getMaximumWindowBounds() is a function supplied to openjdk to determine the largest size window which fits in the current desktop environment on a single display, taking into account OS menu bars. See http://docs.oracle.com/javase/1.5.0/docs/api/java/awt/GraphicsEnvironment.html#getMaximumWindowBounds()

Running the attached program on my system returns

thue@Thue-Desktop:~$ java test
java.awt.Rectangle[x=3265,y=24,width=255,height=1176]

So GraphicsEnvironment.getMaximumWindowBounds() thinks that there is only room for a 255 pixel wide window on my desktop. Which is obviously silly

I have a fairly standard dual-screen setup, with the left screen 1600 wide and the right screen 1920 wide. Java is trying to open the Window on the right screen. The width of 255 is very probably 1920-1600-65=255, where 65 pixels is the width of the unity menu as measured via a screenshot in GIMP.

I encountered the problem while trying to run the April 22 git version of FreeCol. The example code below is snipped from there.

Both Java 6 and Java 7 have the problem.

Regards, Thue

----------------------

import java.awt.GraphicsEnvironment;
import java.awt.Rectangle;

class test {

    public static void main(String[] args) {
        determineWindowSize();
    }

    public static void determineWindowSize() {
        final GraphicsEnvironment lge
            = GraphicsEnvironment.getLocalGraphicsEnvironment();

        Rectangle bounds = lge.getMaximumWindowBounds();
        System.out.println(bounds);
    }

}

affects: qtwebkit-opensource-src (Ubuntu) → openjdk-6 (Ubuntu)
affects: openjdk-6 (Ubuntu) → openjdk-7 (Ubuntu)
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in openjdk-7 (Ubuntu):
status: New → Confirmed
Don-vip (vincent-privat)
Changed in josm:
importance: Unknown → Critical
Revision history for this message
Don-vip (vincent-privat) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.