KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > workflow > designer > swing > ScreenUtils


1 package com.opensymphony.workflow.designer.swing;
2
3 import java.awt.Dimension JavaDoc;
4 import java.awt.Toolkit JavaDoc;
5 import java.awt.Window JavaDoc;
6
7 /**
8  * @author Gulei
9  */

10 public class ScreenUtils
11 {
12   public static void center(Window JavaDoc frame)
13   {
14     Dimension JavaDoc screenSize = Toolkit.getDefaultToolkit().getScreenSize();
15     Dimension JavaDoc frameSize = frame.getSize();
16     frame.setLocation(screenSize.width / 2 - (frameSize.width / 2), screenSize.height / 2 - (frameSize.height / 2));
17   }
18
19 }
20
Popular Tags