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

Calling to Toolkit.getScreenInsets() cause exception

XMLWordPrintable

    • x86_64
    • linux_ubuntu

      ADDITIONAL SYSTEM INFORMATION :
      system: Ubuntu 18.04 64 bit
      java: 10.0.1
      graphic card: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)
      Screens: :0.0 1366x768, :0.1 1920x1080, :0.2 1920x1080

      A DESCRIPTION OF THE PROBLEM :
      Calling to function getMaximumWindowBounds cause exception. I have Ubuntu 18.04 64 bit with 3 screens.

      code:
      System.out.println(GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds());

      java 8 result:
      java.awt.Rectangle[x=1366,y=0,width=1920,height=1080]

      java 10.0.1 result:
      Exception in thread "main" java.lang.IllegalArgumentException: Window must not be zero
      at java.desktop/sun.awt.X11.XAtom.checkWindow(XAtom.java:774)
      at java.desktop/sun.awt.X11.XAtom.getAtomData(XAtom.java:465)
      at java.desktop/sun.awt.X11.XToolkit.getWorkArea(XToolkit.java:805)
      at java.desktop/sun.awt.X11.XToolkit.getInsets(XToolkit.java:881)
      at java.desktop/sun.awt.X11.XToolkit.getScreenInsets(XToolkit.java:869)
      at java.desktop/sun.java2d.SunGraphicsEnvironment.getUsableBounds(SunGraphicsEnvironment.java:274)
      at java.desktop/sun.awt.X11GraphicsEnvironment.getXineramaWindowBounds(X11GraphicsEnvironment.java:390)
      at java.desktop/sun.awt.X11GraphicsEnvironment.getMaximumWindowBounds(X11GraphicsEnvironment.java:314)
      at main.main(main.java:6)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      simply call funciton

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      function will return value
      ACTUAL -
      function is throwing exception

      ---------- BEGIN SOURCE ----------
      import java.awt.GraphicsEnvironment;

      public class main {

      public static void main(String[] args) {

        System.out.println(GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds());
      }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: