0

At some point in an application, I need to get the whole area of a screen that is useable (without toolbars, and in Windows 8, side-by-side apps). That is done by either calling

      GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();

or, if you want to do it directy

 GraphicsConfiguration gc = myGraphicsDevice.getDefaultConfiguration();
    Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(gc);
    Rectangle usableBounds = gc.getBounds();
    usableBounds.x += insets.left;
    usableBounds.y += insets.top;
    usableBounds.width -= (insets.left + insets.right);
    usableBounds.height -= (insets.top + insets.bottom);

(which, is the exact same way in which SunGraphicsEnviroment performs the first operation).

The problem I'm having is that, when I'm on single-screen, getScreenInsets() correctly take the side-by-side app into account (getting a result like java.awt.Insets[top=0,left=971,bottom=48,right=0]). However, if I'm in a multiscreen enviroment, BOTH screens show insets with left = 0 (java.awt.Insets[top=0,left=0,bottom=60,right=0])

Should getInsets used differently with multiscreen, or is this a Java problem? I'm using 1.7v40. I haven't found anything like this on the Oracle bug database, either.

Silverlord
  • 88
  • 7

1 Answers1

0

Answering myself: yes. It is a Java Bug

http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6899304

If you need to do that, you need to go down to native code and use the Windows API or wait for a Java patch.

Silverlord
  • 88
  • 7