Java GraphicsDevice .getConfigurations ()

Syntax

GraphicsDevice.getConfigurations() has the following syntax.

public abstract GraphicsConfiguration [] getConfigurations()

Example

In the following code shows how to use GraphicsDevice.getConfigurations() method.


/* w  ww.j  a  v  a 2s  .  com*/
import java.awt.Dimension;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Point;
import java.awt.Rectangle;

public class Main {

  public static void main(String[] args) {
    GraphicsEnvironment ge;
    ge = GraphicsEnvironment.getLocalGraphicsEnvironment();

    Rectangle vBounds = new Rectangle();

    GraphicsDevice[] gdArray = ge.getScreenDevices();

    for (int i = 0; i < gdArray.length; i++) {
      GraphicsDevice gd = gdArray[i];

      GraphicsConfiguration[] gcArray = gd.getConfigurations();

      for (int j = 0; j < gcArray.length; j++)
        vBounds = vBounds.union(gcArray[j].getBounds());
    }

    Point origin = vBounds.getLocation();
    System.out.println("Virtual x = " + origin.x);
    System.out.println("Virtual y = " + origin.y);

    Dimension size = vBounds.getSize();
    System.out.println("Virtual width = " + size.width);
    System.out.println("Virtual height = " + size.height);
  }
}




















Home »
  Java Tutorial »
    java.awt »




BasicStroke
BorderLayout
CardLayout
Color
Cursor
Desktop
DesktopManager
DisplayMode
EventQueue
FlowLayout
FocusTraversalPolicy
Font
FontMetrics
GradientPaint
Graphics
Graphics2D
GraphicsConfiguration
GraphicsDevice
GraphicsEnvironment
GridBagConstraints
GridBagLayout
GridLayout
Image
ItemSelectable
KeyboardFocusManager
LayoutManager
LayoutManager2
Point
Rectangle
Robot
Shape
SplashScreen
SystemColor
SystemTray
TexturePaint
TrayIcon
Toolkit
Transparency