Module java.desktop
Package java.awt

Class GraphicsDevice

java.lang.Object
java.awt.GraphicsDevice

public abstract class GraphicsDevice extends 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: