GraphicsDevice: getConfigurations() : GraphicsDevice : java.awt : Java by API examples (example source code) Organized by topic

Java by API
C++
PHP
Java by API Home »  java.awt   » [  GraphicsDevice  ]   
 



GraphicsDevice: getConfigurations()

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 MainClass {

  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);
  }
}

           
       
Related examples in the same category
1.  GraphicsDevice: getIDstring()
























Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.