@@ -163,11 +163,15 @@ /** * Returns the default screen graphics device. */ public GraphicsDevice getDefaultScreenDevice() { - return getScreenDevices()[0]; + GraphicsDevice[] screens = getScreenDevices(); + if (screens.length == 0) { + throw new AWTError("no screen devices"); + } + return screens[0]; } /** * Returns a Graphics2D object for rendering into the * given BufferedImage.