package cz.neubauer.tomas.hazardanalysis.viewcontroller.windowmanipulator;

import java.awt.GraphicsEnvironment;
import java.awt.Window;

/**
 * Třída, která umí manipulovat s okny.
 * 
 * @author Tomáš Neubauer
 */
public final class WindowManipulator {

	/**
	 * Vycentruje dané okno do středu obrazovky
	 */
	public static void centerWindow(Window okno) {
		int screenWidth = GraphicsEnvironment.getLocalGraphicsEnvironment()
				.getScreenDevices()[0].getDisplayMode().getWidth();
		int screenHeight = GraphicsEnvironment.getLocalGraphicsEnvironment()
				.getScreenDevices()[0].getDisplayMode().getHeight();
		okno.setLocation(screenWidth / 2 - okno.getWidth() / 2, screenHeight
				/ 2 - okno.getHeight() / 2);
	}
}
