Java Swing Tutorial - Java GraphicsEnvironment .getCenterPoint ()








Syntax

GraphicsEnvironment.getCenterPoint() has the following syntax.

public Point getCenterPoint()   throws HeadlessException

Example

In the following code shows how to use GraphicsEnvironment.getCenterPoint() method.

/*w  ww . java2 s.  co m*/
import java.awt.GraphicsEnvironment;
import java.awt.Point;

public class Main {

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

    System.out.println(center);
  }
}

The code above generates the following result.