jdk/src/windows/classes/sun/awt/Win32GraphicsEnvironment.java
Print this page
@@ -91,11 +91,13 @@
protected native int getNumScreens();
protected native int getDefaultScreen();
public GraphicsDevice getDefaultScreenDevice() {
- return getScreenDevices()[getDefaultScreen()];
+ GraphicsDevice[] screens = getScreenDevices();
+ int index = getDefaultScreen();
+ return screens[screens.length <= index ? 0 : index];
}
/**
* Returns the number of pixels per logical inch along the screen width.
* In a system with multiple display monitors, this value is the same for