Java GUI之GraphicsEnvironment

鍾超發表於2011-11-26
package com.sinosuperman.driver;

import java.awt.GraphicsEnvironment;
import java.awt.Rectangle;

public class MainBench {
	public static void main(String[] args) {
		GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
		
		Rectangle rec = env.getMaximumWindowBounds();
		System.out.println("Rectangle: " + rec);
		System.out.println("Rectangle center x: " + rec.getCenterX());
		System.out.println("Rectangle center y: " + rec.getCenterY());
		
		System.out.println("Environment center point: " + env.getCenterPoint());
		System.out.println("Environment center point x: " + env.getCenterPoint().getX());
		System.out.println("Environment center point y: " + env.getCenterPoint().getY());
	}
}

相關文章