164 } 165 166 for (final int id : getDisplayIDs()) { 167 devices.put(id, old.containsKey(id) ? old.get(id) 168 : new CGraphicsDevice(id)); 169 } 170 } 171 displayChanged(); 172 } 173 174 @Override 175 public synchronized GraphicsDevice getDefaultScreenDevice() throws HeadlessException { 176 final int mainDisplayID = getMainDisplayID(); 177 CGraphicsDevice d = devices.get(mainDisplayID); 178 if (d == null) { 179 // we do not expect that this may happen, the only response 180 // is to re-initialize the list of devices 181 initDevices(); 182 183 d = devices.get(mainDisplayID); 184 } 185 return d; 186 } 187 188 @Override 189 public synchronized GraphicsDevice[] getScreenDevices() throws HeadlessException { 190 return devices.values().toArray(new CGraphicsDevice[devices.values().size()]); 191 } 192 193 public synchronized GraphicsDevice getScreenDevice(int displayID) { 194 return devices.get(displayID); 195 } 196 197 @Override 198 protected synchronized int getNumScreens() { 199 return devices.size(); 200 } 201 202 @Override 203 protected GraphicsDevice makeScreenDevice(int screennum) { | 164 } 165 166 for (final int id : getDisplayIDs()) { 167 devices.put(id, old.containsKey(id) ? old.get(id) 168 : new CGraphicsDevice(id)); 169 } 170 } 171 displayChanged(); 172 } 173 174 @Override 175 public synchronized GraphicsDevice getDefaultScreenDevice() throws HeadlessException { 176 final int mainDisplayID = getMainDisplayID(); 177 CGraphicsDevice d = devices.get(mainDisplayID); 178 if (d == null) { 179 // we do not expect that this may happen, the only response 180 // is to re-initialize the list of devices 181 initDevices(); 182 183 d = devices.get(mainDisplayID); 184 if (d == null) { 185 throw new AWTError("no screen devices"); 186 } 187 } 188 return d; 189 } 190 191 @Override 192 public synchronized GraphicsDevice[] getScreenDevices() throws HeadlessException { 193 return devices.values().toArray(new CGraphicsDevice[devices.values().size()]); 194 } 195 196 public synchronized GraphicsDevice getScreenDevice(int displayID) { 197 return devices.get(displayID); 198 } 199 200 @Override 201 protected synchronized int getNumScreens() { 202 return devices.size(); 203 } 204 205 @Override 206 protected GraphicsDevice makeScreenDevice(int screennum) { |