|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.evanmclean.evlib.swing.Screen
public final class Screen
Utilities for managing windows on screen and screen dimensions.
Method Summary | |
---|---|
static void |
centreOn(Window window,
Window parent)
Centre the window over the parent window, ensuring that it is still entirely visible on the screen. |
static void |
centreScreen(Window window)
Centre the window on the primary display screen. |
static void |
clearWindowSizePos(Class<?> cls)
Clear the size position preferences for the window. |
static void |
clearWindowSizePos(Class<?> cls,
String key)
Clear the size position preferences for the window. |
static void |
clearWindowSizePos(Window window)
Clear the size position preferences for the window. |
static void |
clearWindowSizePos(Window window,
String key)
Clear the size position preferences for the window. |
static Preferences |
getPref(Window window)
Helper function that gets the default preferences node for a window. |
static boolean |
getWindowPos(Preferences pref,
String key,
Point pos)
Retrieve the saved position information from a preferences key. |
static boolean |
getWindowPos(Window window)
Position a window based on the saved position information from a preferences key, ensuring that the window is still entirely on the screen. |
static boolean |
getWindowPos(Window window,
String key)
Position a window based on the saved position information from a preferences key, ensuring that the window is still entirely on the screen. |
static boolean |
getWindowSize(Preferences pref,
String key,
Dimension size)
Retrieve the saved size information from a preferences key. |
static boolean |
getWindowSize(Window window)
Position a window based on the saved size information from a preferences key, ensuring that the window is still entirely on the screen. |
static boolean |
getWindowSize(Window window,
String key)
Position a window based on the saved size information from a preferences key, ensuring that the window is still entirely on the screen. |
static boolean |
getWindowSizePos(Preferences pref,
String key,
Dimension size,
Point pos)
Retrieve the saved size and position information from a preferences key. |
static boolean |
getWindowSizePos(Window window)
Position a window based on the saved size and position information from a preferences key, ensuring that the window is still entirely on the screen. |
static boolean |
getWindowSizePos(Window window,
String key)
Position a window based on the saved size and position information from a preferences key, ensuring that the window is still entirely on the screen. |
static void |
main(String[] args)
|
static Point |
onScreen(int xpos,
int ypos,
Dimension size)
Ensure that, given the specified size, the specified position will have the entire window on the screen (or failing that, in the top left corner). |
static Point |
onScreen(int xpos,
int ypos,
int width,
int height)
Ensure that, given the specified size, the specified position will have the entire window on the screen (or failing that, in the top left corner). |
static boolean |
onScreen(Point pos,
Dimension size)
Ensure that, given the specified size, the specified position will have the entire window on the screen (or failing that, in the top left corner). |
static boolean |
onScreen(Point pos,
int width,
int height)
Ensure that, given the specified size, the specified position will have the entire window on a screen (or failing that, in the top left corner). |
static boolean |
onScreen(Window window)
Ensure that the entire window is on the screen (or failing that, in the top left corner). |
static boolean |
saveWindowPos(Preferences pref,
String key,
int xpos,
int ypos)
Save position information in a preferences key. |
static boolean |
saveWindowPos(Window window)
Save position information in the default preferences key for the window. |
static boolean |
saveWindowPos(Window window,
String key)
Save position information in the default preferences key for the window. |
static boolean |
saveWindowSize(Preferences pref,
String key,
int width,
int height)
Save size information in a preferences key. |
static boolean |
saveWindowSize(Window window)
Save size information in the default preferences key for the window. |
static boolean |
saveWindowSize(Window window,
String key)
Save size information in the default preferences key for the window. |
static boolean |
saveWindowSizePos(Preferences pref,
String key,
int width,
int height,
int xpos,
int ypos)
Save size and position information in a preferences key. |
static boolean |
saveWindowSizePos(Window window)
Save size and position information in the default preferences key for the window. |
static boolean |
saveWindowSizePos(Window window,
String key)
Save size and position information in the default preferences key for the window. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void centreOn(Window window, Window parent)
window
- The window to position.parent
- The window to centre over.public static void centreScreen(Window window)
window
- The window to position.public static void clearWindowSizePos(Class<?> cls)
cls
- The class to clear.public static void clearWindowSizePos(Class<?> cls, String key)
cls
- The class to clear.key
- The key to retrieve from.public static void clearWindowSizePos(Window window)
window
- The window to clear.public static void clearWindowSizePos(Window window, String key)
window
- The window to clear.key
- The key to retrieve from.public static Preferences getPref(Window window)
window
-
public static boolean getWindowPos(Preferences pref, String key, Point pos)
pref
- The preferences key to retrieve from.key
- The key to retrieve from.pos
- Store the position values here.
public static boolean getWindowPos(Window window)
window
- The window to size and position.
public static boolean getWindowPos(Window window, String key)
window
- The window to size and position.key
- The key to retrieve from.
public static boolean getWindowSize(Preferences pref, String key, Dimension size)
pref
- The preferences key to retrieve from.key
- The key to retrieve from.size
- Store the size values here.
public static boolean getWindowSize(Window window)
window
- The window to size and position.
public static boolean getWindowSize(Window window, String key)
window
- The window to size and position.key
- The key to retrieve from.
public static boolean getWindowSizePos(Preferences pref, String key, Dimension size, Point pos)
pref
- The preferences key to retrieve from.key
- The key to retrieve from.size
- Store the size values here (if not null).pos
- Store the position values here (if not null).
public static boolean getWindowSizePos(Window window)
window
- The window to size and position.
public static boolean getWindowSizePos(Window window, String key)
window
- The window to size and position.key
- The key to retrieve from.
public static void main(String[] args)
public static Point onScreen(int xpos, int ypos, Dimension size)
xpos
- The current x coordinate of the window.ypos
- The current y coordinate of the window.size
- The size of the window.
public static Point onScreen(int xpos, int ypos, int width, int height)
xpos
- The current x coordinate of the window.ypos
- The current y coordinate of the window.width
- The width of the window.height
- The size of the window.
public static boolean onScreen(Point pos, Dimension size)
pos
- The current position, which will be modified if necessary.size
- The size of the window.
public static boolean onScreen(Point pos, int width, int height)
pos
- The current position, which will be modified if necessary.width
- The width of the window.height
- The size of the window.
public static boolean onScreen(Window window)
window
- The window to reposition if necessary.
public static boolean saveWindowPos(Preferences pref, String key, int xpos, int ypos)
pref
- The preference node to store in.key
- The key to store in.xpos
- ypos
-
public static boolean saveWindowPos(Window window)
window
- The window to store the information for.
public static boolean saveWindowPos(Window window, String key)
window
- The window to store the information for.key
- The key to store in.
public static boolean saveWindowSize(Preferences pref, String key, int width, int height)
pref
- The preference node to store in.key
- The key to store in.width
- height
-
public static boolean saveWindowSize(Window window)
window
- The window to store the information for.
public static boolean saveWindowSize(Window window, String key)
window
- The window to store the information for.key
- The key to store in.
public static boolean saveWindowSizePos(Preferences pref, String key, int width, int height, int xpos, int ypos)
pref
- The preference node to store in.key
- The key to store in.width
- height
- xpos
- ypos
-
public static boolean saveWindowSizePos(Window window)
window
- The window to store the information for.
public static boolean saveWindowSizePos(Window window, String key)
window
- The window to store the information for.key
- The key to store in.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |