Static Public Member Functions | |
static void | centerWindow (JFrame frame) |
Plops the frame into the center of the desktop. | |
static void | enterFullScreenIfPossible (JFrame mainAppFrame) |
static void | exitFullScreen (JFrame mainAppFrame) |
static Point | getCachedWindowOrigin (int windowWidth, int windowHeight, int where) |
Determines where to put windows based on the cached state. | |
static Rectangle | getDesktopBounds () |
static Dimension | getDesktopSize () |
static int | getScreenHeight () |
static Dimension | getScreenSize () |
static int | getScreenWidth () |
static Point | getWindowOrigin (int windowWidth, int windowHeight, int where) |
Given a size (width, height) of a window, and an intended location on the desktop, it returns the x, y location of where the origin should reside. | |
static Point | getWindowOrigin (Frame frame, int where) |
static void | initCachedWindowState () |
Call this before calling getCachedWindowOrigin(. | |
static void | main (String[] args) throws InterruptedException |
static JFrame | openInJFrame (Container content, int width, int height) |
Opens a container inside a JFrame. | |
static JFrame | openInJFrame (Container content, int width, int height, String title) |
Opens a container inside a JFrame. | |
static JFrame | openInJFrame (Container content, int width, int height, String title, Color bgColor) |
static JFrame | openInJFrame (Container content, int width, int height, String title, Color bgColor, boolean exitOnClose) |
Opens a container inside a JFrame. | |
static void | setJavaLookAndFeel () |
The pleasant-looking *cough* Java look and feel. | |
static void | setMotifLookAndFeel () |
Old Skool Look and Feel. | |
static void | setNativeLookAndFeel () |
Windows, Mac, or Unix look and feels. | |
static void | fitToDesktop (final JFrame frame) |
Static Public Attributes | |
static final int | DESKTOP_CENTER = 0 |
static final int | DESKTOP_EAST = 2 |
static final int | DESKTOP_NORTH = 3 |
static final int | DESKTOP_NORTHEAST = 6 |
static final int | DESKTOP_NORTHWEST = 5 |
static final int | DESKTOP_SOUTH = 4 |
static final int | DESKTOP_SOUTHEAST = 8 |
static final int | DESKTOP_SOUTHWEST = 7 |
static final int | DESKTOP_WEST = 1 |
static final int | INVALID_MAX = 18 |
static final int | INVALID_MIN = -1 |
static final int | SCREEN_CENTER = 9 |
static final int | SCREEN_EAST = 11 |
static final int | SCREEN_NORTH = 12 |
static final int | SCREEN_NORTHEAST = 15 |
static final int | SCREEN_NORTHWEST = 14 |
static final int | SCREEN_SOUTH = 13 |
static final int | SCREEN_SOUTHEAST = 17 |
static final int | SCREEN_SOUTHWEST = 16 |
static final int | SCREEN_WEST = 10 |
Static Package Functions | |
[static initializer] |
This software is distributed under the BSD License.
Definition at line 25 of file WindowUtils.java.
static void centerWindow | ( | JFrame | frame | ) | [static] |
Plops the frame into the center of the desktop.
frame |
Definition at line 97 of file WindowUtils.java.
References WindowUtils.getWindowOrigin().
static void enterFullScreenIfPossible | ( | JFrame | mainAppFrame | ) | [static] |
mainAppFrame | window to be made full screen. |
Definition at line 106 of file WindowUtils.java.
References WindowUtils.getScreenSize().
Referenced by WindowUtils.main().
static void exitFullScreen | ( | JFrame | mainAppFrame | ) | [static] |
mainAppFrame |
Definition at line 144 of file WindowUtils.java.
Referenced by WindowUtils.main().
static void fitToDesktop | ( | final JFrame | frame | ) | [static] |
static Point getCachedWindowOrigin | ( | int | windowWidth, | |
int | windowHeight, | |||
int | where | |||
) | [static] |
Determines where to put windows based on the cached state.
windowWidth | ||
windowHeight | ||
where |
Definition at line 163 of file WindowUtils.java.
References WindowUtils.DESKTOP_CENTER, WindowUtils.DESKTOP_EAST, WindowUtils.DESKTOP_NORTH, WindowUtils.DESKTOP_NORTHEAST, WindowUtils.DESKTOP_NORTHWEST, WindowUtils.DESKTOP_SOUTH, WindowUtils.DESKTOP_SOUTHEAST, WindowUtils.DESKTOP_SOUTHWEST, WindowUtils.DESKTOP_WEST, WindowUtils.INVALID_MAX, WindowUtils.INVALID_MIN, WindowUtils.SCREEN_CENTER, WindowUtils.SCREEN_EAST, WindowUtils.SCREEN_NORTH, WindowUtils.SCREEN_NORTHEAST, WindowUtils.SCREEN_NORTHWEST, WindowUtils.SCREEN_SOUTH, WindowUtils.SCREEN_SOUTHEAST, WindowUtils.SCREEN_SOUTHWEST, and WindowUtils.SCREEN_WEST.
Referenced by WindowUtils.getWindowOrigin().
static Rectangle getDesktopBounds | ( | ) | [static] |
Definition at line 272 of file WindowUtils.java.
static Dimension getDesktopSize | ( | ) | [static] |
static int getScreenHeight | ( | ) | [static] |
Definition at line 286 of file WindowUtils.java.
Referenced by WindowUtils.getScreenSize().
static Dimension getScreenSize | ( | ) | [static] |
Definition at line 293 of file WindowUtils.java.
References WindowUtils.getScreenHeight(), and WindowUtils.getScreenWidth().
Referenced by WindowUtils.enterFullScreenIfPossible().
static int getScreenWidth | ( | ) | [static] |
Definition at line 300 of file WindowUtils.java.
Referenced by WindowUtils.getScreenSize().
static Point getWindowOrigin | ( | Frame | frame, | |
int | where | |||
) | [static] |
frame | ||
where |
Definition at line 326 of file WindowUtils.java.
References WindowUtils.getCachedWindowOrigin().
static Point getWindowOrigin | ( | int | windowWidth, | |
int | windowHeight, | |||
int | where | |||
) | [static] |
Given a size (width, height) of a window, and an intended location on the desktop, it returns the x, y location of where the origin should reside.
This method will be pretty resilient to the user changing his/her interface (taskbar locations, etc). If you want a faster method, but would sacrifice a (little) bit of assurances... then use getCachedWindowOrigin(...) directly (after calling initCachedWindowState() once)
windowWidth | ||
windowHeight | ||
where |
Definition at line 316 of file WindowUtils.java.
References WindowUtils.getCachedWindowOrigin(), and WindowUtils.initCachedWindowState().
Referenced by WindowUtils.centerWindow().
static void initCachedWindowState | ( | ) | [static] |
Call this before calling getCachedWindowOrigin(.
..) to get the current state of the user's screen and desktop size. The user may have changed it since the last call. This is called once when WindowUtils is first accessed.
Definition at line 335 of file WindowUtils.java.
Referenced by WindowUtils.getWindowOrigin().
static void main | ( | String[] | args | ) | throws InterruptedException [static] |
args |
InterruptedException |
Definition at line 352 of file WindowUtils.java.
References WindowUtils.enterFullScreenIfPossible(), and WindowUtils.exitFullScreen().
static JFrame openInJFrame | ( | Container | content, | |
int | width, | |||
int | height, | |||
String | title, | |||
Color | bgColor, | |||
boolean | exitOnClose | |||
) | [static] |
Opens a container inside a JFrame.
Useful for quick testing.
content | ||
width | ||
height | ||
title | ||
bgColor | ||
exitOnClose |
Definition at line 413 of file WindowUtils.java.
static JFrame openInJFrame | ( | Container | content, | |
int | width, | |||
int | height, | |||
String | title, | |||
Color | bgColor | |||
) | [static] |
content | ||
width | ||
height | ||
title | ||
bgColor |
Definition at line 397 of file WindowUtils.java.
References WindowUtils.openInJFrame().
static JFrame openInJFrame | ( | Container | content, | |
int | width, | |||
int | height, | |||
String | title | |||
) | [static] |
Opens a container inside a JFrame.
Useful for quick testing.
content | ||
width | ||
height | ||
title |
Definition at line 385 of file WindowUtils.java.
References WindowUtils.openInJFrame().
static JFrame openInJFrame | ( | Container | content, | |
int | width, | |||
int | height | |||
) | [static] |
Opens a container inside a JFrame.
Useful for quick testing.
content | ||
width | ||
height |
Definition at line 372 of file WindowUtils.java.
Referenced by WindowUtils.openInJFrame().