whitespace fixups
[jSite2.git] / src / net / pterodactylus / util / swing / SwingUtils.java
index 103297b..08f79bb 100644 (file)
@@ -27,20 +27,30 @@ import java.awt.Window;
 
 /**
  * Helper utilities for working with Swing.
- * 
+ *
  * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
- * @version $Id$
  */
 public class SwingUtils {
 
+       /** The screen size. */
+       private static Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
+
+       /**
+        * Returns the size of the screen.
+        *
+        * @return The size of the screen
+        */
+       public static Dimension getScreenSize() {
+               return new Dimension(screenDimension);
+       }
+
        /**
         * Centers the given window on the screen.
-        * 
+        *
         * @param window
         *            The window to center
         */
        public static void center(Window window) {
-               Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
                Dimension frameDimension = window.getSize();
                window.setLocation((screenDimension.width - frameDimension.width) >> 1, (screenDimension.height - frameDimension.height) >> 1);
        }
@@ -48,7 +58,7 @@ public class SwingUtils {
        /**
         * {@link Window#pack() Packs} the given window and positions it so that its
         * center stays the same.
-        * 
+        *
         * @param window
         *            The window to pack and recenter
         */
@@ -61,7 +71,7 @@ public class SwingUtils {
 
        /**
         * Returns the center of the given rectangle.
-        * 
+        *
         * @param bounds
         *            The rectangle which center to get
         * @return The center of the rectangle