java.awt

Class GraphicsDevice

  • java.lang.Object
    • java.awt.GraphicsDevice
  • public abstract class GraphicsDevice extends java.lang.Object
    The GraphicsDevice class describes the graphics devices that might be available in a particular graphics environment. These include screen and printer devices. Note that there can be many screens and many printers in an instance of GraphicsEnvironment. Each graphics device has one or more GraphicsConfiguration objects associated with it. These objects specify the different configurations in which the GraphicsDevice can be used.

    In a multi-screen environment, the GraphicsConfiguration objects can be used to render components on multiple screens. The following code sample demonstrates how to create a JFrame object for each GraphicsConfiguration on each screen device in the GraphicsEnvironment:

       GraphicsEnvironment ge = GraphicsEnvironment.
       getLocalGraphicsEnvironment();
       GraphicsDevice[] gs = ge.getScreenDevices();
       for (int j = 0; j < gs.length; j++) {
          GraphicsDevice gd = gs[j];
          GraphicsConfiguration[] gc =
          gd.getConfigurations();
          for (int i=0; i < gc.length; i++) {
             JFrame f = new
             JFrame(gs[j].getDefaultConfiguration());
             Canvas c = new Canvas(gc[i]);
             Rectangle gcBounds = gc[i].getBounds();
             int xoffs = gcBounds.x;
             int yoffs = gcBounds.y;
             f.getContentPane().add(c);
             f.setLocation((i*50)+xoffs, (i*60)+yoffs);
             f.show();
          }
       }
     

    For more information on full-screen exclusive mode API, see the Full-Screen Exclusive Mode API Tutorial.

    See Also:
    GraphicsEnvironment, GraphicsConfiguration
    • Fields 
      Modifier and Type Field and Description
      Ordinary member indicator TYPE_IMAGE_BUFFER Reveal DetailHide Detail
      Device is an image buffer.
      Ordinary member indicator TYPE_PRINTER Reveal DetailHide Detail
      Device is a printer.
      Ordinary member indicator TYPE_RASTER_SCREEN Reveal DetailHide Detail
      Device is a raster screen.
    • Methods 
      Modifier and Type Method and Description
      Ordinary member indicator getAvailableAcceleratedMemory Reveal DetailHide Detail
      This method returns the number of bytes available in accelerated memory on this device.
      Ordinary member indicator getBestConfiguration Reveal DetailHide Detail
      Returns the "best" configuration possible that passes the criteria defined in the GraphicsConfigTemplate.
      Ordinary member indicator getConfigurations Reveal DetailHide Detail
      Returns all of the GraphicsConfiguration objects associated with this GraphicsDevice.
      Ordinary member indicator getDefaultConfiguration Reveal DetailHide Detail
      Returns the default GraphicsConfiguration associated with this GraphicsDevice.
      Ordinary member indicator getDisplayMode Reveal DetailHide Detail
      Returns the current display mode of this GraphicsDevice.
      Ordinary member indicator getDisplayModes Reveal DetailHide Detail
      Returns all display modes available for this GraphicsDevice.
      Ordinary member indicator getFullScreenWindow Reveal DetailHide Detail
      Returns the Window object representing the full-screen window if the device is in full-screen mode.
      Ordinary member indicator getIDstring Reveal DetailHide Detail
      Returns the identification string associated with this GraphicsDevice.
      Ordinary member indicator getType Reveal DetailHide Detail
      Returns the type of this GraphicsDevice.
      Ordinary member indicator isDisplayChangeSupported Reveal DetailHide Detail
      Returns true if this GraphicsDevice supports low-level display changes.
      Ordinary member indicator isFullScreenSupported Reveal DetailHide Detail
      Returns true if this GraphicsDevice supports full-screen exclusive mode.
      Ordinary member indicator isWindowTranslucencySupported Reveal DetailHide Detail
      Returns whether the given level of translucency is supported by this graphics device.
      Ordinary member indicator setDisplayMode Reveal DetailHide Detail
      Sets the display mode of this graphics device.
      Ordinary member indicator setFullScreenWindow Reveal DetailHide Detail
      Enter full-screen mode, or return to windowed mode.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
This document was created by Dulcet from the OpenJDK sources. Copyright © 1993, 2012 Oracle and/or its affiliates. All rights reserved.

SourceForge