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

java.awt.GraphicsDevice.setFullScreenWindow throws NPE for windows with background color not set

XMLWordPrintable

    • b57
    • 7
    • b59
    • generic
    • generic
    • Verified

      The following code:

      public class Temp {
          public static void main(String[] args) {
              GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
              GraphicsDevice[] devices = ge.getScreenDevices();
              for (GraphicsDevice device : devices) {
                  Frame w = new Frame();
                  //w.setBackground(Color.BLACK);
                  device.setFullScreenWindow(w);
              }
          }
      }

      throws NPE on JDK7 b57 like the following:

      Exception in thread "main" java.lang.NullPointerException
      at java.awt.GraphicsDevice.setFullScreenWindow(GraphicsDevice.java:285)
      at sun.awt.Win32GraphicsDevice.setFullScreenWindow(Win32GraphicsDevice.java:365)
      at shapedtrans.Temp.main(Temp.java:12)
              ...

      Code sample works for JDK6

            art Artem Ananiev (Inactive)
            dbessono Dmitry Bessonov
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: