1 7 8 9 package java.awt; 10 11 import java.awt.image.ColorModel ; 12 13 52 public abstract class GraphicsDevice { 53 54 private Window fullScreenWindow; 55 private Rectangle windowedModeBounds; 56 57 64 protected GraphicsDevice() { 65 } 66 67 70 public final static int TYPE_RASTER_SCREEN = 0; 71 72 75 public final static int TYPE_PRINTER = 1; 76 77 81 public final static int TYPE_IMAGE_BUFFER = 2; 82 83 91 public abstract int getType(); 92 93 114 public abstract String getIDstring(); 115 116 123 public abstract GraphicsConfiguration [] getConfigurations(); 124 125 131 public abstract GraphicsConfiguration getDefaultConfiguration(); 132 133 143 public GraphicsConfiguration 144 getBestConfiguration(GraphicsConfigTemplate gct) { 145 GraphicsConfiguration [] configs = getConfigurations(); 146 return gct.getBestConfiguration(configs); 147 } 148 149 156 public boolean isFullScreenSupported() { 157 return false; 158 } 159 160 197 public void setFullScreenWindow(Window w) { 198 DisplayMode dm; 200 if (w == null) { 201 dm = null; 202 } else { 203 dm = getDisplayMode(); 204 } 205 if (fullScreenWindow != null && windowedModeBounds != null) { 206 fullScreenWindow.setBounds(windowedModeBounds); 207 } 208 fullScreenWindow = w; 210 if (fullScreenWindow != null) { 211 windowedModeBounds = fullScreenWindow.getBounds(); 212 fullScreenWindow.setBounds(0, 0, dm.getWidth(), dm.getHeight()); 213 fullScreenWindow.setVisible(true); 214 fullScreenWindow.toFront(); 215 } 216 } 217 218 227 public Window getFullScreenWindow() { 228 return fullScreenWindow; 229 } 230 231 240 public boolean isDisplayChangeSupported() { 241 return false; 242 } 243 244 258 public void setDisplayMode(DisplayMode dm) { 259 throw new UnsupportedOperationException ("Cannot change display mode"); 260 } 261 262 269 public DisplayMode getDisplayMode() { 270 GraphicsConfiguration gc = getDefaultConfiguration(); 271 Rectangle r = gc.getBounds(); 272 ColorModel cm = gc.getColorModel(); 273 return new DisplayMode (r.width, r.height, cm.getPixelSize(), 0); 274 } 275 276 282 public DisplayMode [] getDisplayModes() { 283 return new DisplayMode [] { getDisplayMode() }; 284 } 285 286 313 public int getAvailableAcceleratedMemory() { 314 return -1; 315 } 316 } 317 | Popular Tags |