< prev index next >

src/java.desktop/windows/classes/sun/awt/Win32GraphicsEnvironment.java

Print this page




  80 
  81     public Win32GraphicsEnvironment() {
  82     }
  83 
  84     protected native int getNumScreens();
  85     private native int getDefaultScreen();
  86 
  87     public GraphicsDevice getDefaultScreenDevice() {
  88         GraphicsDevice[] screens = getScreenDevices();
  89         if (screens.length == 0) {
  90             throw new AWTError("no screen devices");
  91         }
  92         int index = getDefaultScreen();
  93         return screens[0 < index && index < screens.length ? index : 0];
  94     }
  95 
  96     /**
  97      * Returns the number of pixels per logical inch along the screen width.
  98      * In a system with multiple display monitors, this value is the same for
  99      * all monitors.
 100      * @returns number of pixels per logical inch in X direction
 101      */
 102     public native int getXResolution();
 103     /**
 104      * Returns the number of pixels per logical inch along the screen height.
 105      * In a system with multiple display monitors, this value is the same for
 106      * all monitors.
 107      * @returns number of pixels per logical inch in Y direction
 108      */
 109     public native int getYResolution();
 110 
 111 
 112 /*
 113  * ----DISPLAY CHANGE SUPPORT----
 114  */
 115 
 116     // list of invalidated graphics devices (those which were removed)
 117     private ArrayList<WeakReference<Win32GraphicsDevice>> oldDevices;
 118     /*
 119      * From DisplayChangeListener interface.
 120      * Called from WToolkit and executed on the event thread when the
 121      * display settings are changed.
 122      */
 123     @Override
 124     public void displayChanged() {
 125         // getNumScreens() will return the correct current number of screens
 126         GraphicsDevice newDevices[] = new GraphicsDevice[getNumScreens()];
 127         GraphicsDevice oldScreens[] = screens;




  80 
  81     public Win32GraphicsEnvironment() {
  82     }
  83 
  84     protected native int getNumScreens();
  85     private native int getDefaultScreen();
  86 
  87     public GraphicsDevice getDefaultScreenDevice() {
  88         GraphicsDevice[] screens = getScreenDevices();
  89         if (screens.length == 0) {
  90             throw new AWTError("no screen devices");
  91         }
  92         int index = getDefaultScreen();
  93         return screens[0 < index && index < screens.length ? index : 0];
  94     }
  95 
  96     /**
  97      * Returns the number of pixels per logical inch along the screen width.
  98      * In a system with multiple display monitors, this value is the same for
  99      * all monitors.
 100      * @return number of pixels per logical inch in X direction
 101      */
 102     public native int getXResolution();
 103     /**
 104      * Returns the number of pixels per logical inch along the screen height.
 105      * In a system with multiple display monitors, this value is the same for
 106      * all monitors.
 107      * @return number of pixels per logical inch in Y direction
 108      */
 109     public native int getYResolution();
 110 
 111 
 112 /*
 113  * ----DISPLAY CHANGE SUPPORT----
 114  */
 115 
 116     // list of invalidated graphics devices (those which were removed)
 117     private ArrayList<WeakReference<Win32GraphicsDevice>> oldDevices;
 118     /*
 119      * From DisplayChangeListener interface.
 120      * Called from WToolkit and executed on the event thread when the
 121      * display settings are changed.
 122      */
 123     @Override
 124     public void displayChanged() {
 125         // getNumScreens() will return the correct current number of screens
 126         GraphicsDevice newDevices[] = new GraphicsDevice[getNumScreens()];
 127         GraphicsDevice oldScreens[] = screens;


< prev index next >