|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.stanford.hci.r3.util.WindowUtils
public class WindowUtils
This class contains useful methods for positioning, sizing, and manipulating JFrames and other Window-like elements.
This software is distributed under the BSD License.
Field Summary | |
---|---|
static int |
DESKTOP_CENTER
|
static int |
DESKTOP_EAST
|
static int |
DESKTOP_NORTH
|
static int |
DESKTOP_NORTHEAST
|
static int |
DESKTOP_NORTHWEST
|
static int |
DESKTOP_SOUTH
|
static int |
DESKTOP_SOUTHEAST
|
static int |
DESKTOP_SOUTHWEST
|
static int |
DESKTOP_WEST
|
static int |
INVALID_MAX
|
static int |
INVALID_MIN
|
static int |
SCREEN_CENTER
|
static int |
SCREEN_EAST
|
static int |
SCREEN_NORTH
|
static int |
SCREEN_NORTHEAST
|
static int |
SCREEN_NORTHWEST
|
static int |
SCREEN_SOUTH
|
static int |
SCREEN_SOUTHEAST
|
static int |
SCREEN_SOUTHWEST
|
static int |
SCREEN_WEST
|
Constructor Summary | |
---|---|
WindowUtils()
|
Method Summary | |
---|---|
static void |
centerWindow(javax.swing.JFrame frame)
Plops the frame into the center of the desktop. |
static void |
enterFullScreenIfPossible(javax.swing.JFrame mainAppFrame)
|
static void |
exitFullScreen(javax.swing.JFrame mainAppFrame)
|
static void |
fitToDesktop(javax.swing.JFrame frame)
|
static java.awt.Point |
getCachedWindowOrigin(int windowWidth,
int windowHeight,
int where)
Determines where to put windows based on the cached state |
static java.awt.Rectangle |
getDesktopBounds()
|
static java.awt.Dimension |
getDesktopSize()
|
static int |
getScreenHeight()
|
static java.awt.Dimension |
getScreenSize()
|
static int |
getScreenWidth()
|
static java.awt.Point |
getWindowOrigin(java.awt.Frame frame,
int where)
|
static java.awt.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 void |
initCachedWindowState()
Call this before calling getCachedWindowOrigin(...) to get the current state of the user's screen and desktop size. |
static void |
main(java.lang.String[] args)
|
static javax.swing.JFrame |
openInJFrame(java.awt.Container content,
int width,
int height)
Opens a container inside a JFrame. |
static javax.swing.JFrame |
openInJFrame(java.awt.Container content,
int width,
int height,
java.lang.String title)
Opens a container inside a JFrame. |
static javax.swing.JFrame |
openInJFrame(java.awt.Container content,
int width,
int height,
java.lang.String title,
java.awt.Color bgColor)
|
static javax.swing.JFrame |
openInJFrame(java.awt.Container content,
int width,
int height,
java.lang.String title,
java.awt.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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DESKTOP_CENTER
public static final int DESKTOP_EAST
public static final int DESKTOP_NORTH
public static final int DESKTOP_NORTHEAST
public static final int DESKTOP_NORTHWEST
public static final int DESKTOP_SOUTH
public static final int DESKTOP_SOUTHEAST
public static final int DESKTOP_SOUTHWEST
public static final int DESKTOP_WEST
public static final int INVALID_MAX
public static final int INVALID_MIN
public static final int SCREEN_CENTER
public static final int SCREEN_EAST
public static final int SCREEN_NORTH
public static final int SCREEN_NORTHEAST
public static final int SCREEN_NORTHWEST
public static final int SCREEN_SOUTH
public static final int SCREEN_SOUTHEAST
public static final int SCREEN_SOUTHWEST
public static final int SCREEN_WEST
Constructor Detail |
---|
public WindowUtils()
Method Detail |
---|
public static void centerWindow(javax.swing.JFrame frame)
frame
- public static void enterFullScreenIfPossible(javax.swing.JFrame mainAppFrame)
mainAppFrame
- window to be made full screen.public static void exitFullScreen(javax.swing.JFrame mainAppFrame)
mainAppFrame
- public static java.awt.Point getCachedWindowOrigin(int windowWidth, int windowHeight, int where)
windowWidth
- windowHeight
- where
- util.WindowUtilities.initCachedWindowState()
public static java.awt.Rectangle getDesktopBounds()
public static java.awt.Dimension getDesktopSize()
public static int getScreenHeight()
public static java.awt.Dimension getScreenSize()
public static int getScreenWidth()
public static java.awt.Point getWindowOrigin(int windowWidth, int windowHeight, int where)
windowWidth
- windowHeight
- where
-
public static java.awt.Point getWindowOrigin(java.awt.Frame frame, int where)
frame
- where
-
public static void initCachedWindowState()
public static void main(java.lang.String[] args) throws java.lang.InterruptedException
args
-
java.lang.InterruptedException
public static javax.swing.JFrame openInJFrame(java.awt.Container content, int width, int height)
content
- width
- height
-
public static javax.swing.JFrame openInJFrame(java.awt.Container content, int width, int height, java.lang.String title)
content
- width
- height
- title
-
public static javax.swing.JFrame openInJFrame(java.awt.Container content, int width, int height, java.lang.String title, java.awt.Color bgColor)
content
- width
- height
- title
- bgColor
-
public static javax.swing.JFrame openInJFrame(java.awt.Container content, int width, int height, java.lang.String title, java.awt.Color bgColor, boolean exitOnClose)
content
- width
- height
- title
- bgColor
- exitOnClose
-
public static void setJavaLookAndFeel()
public static void setMotifLookAndFeel()
public static void setNativeLookAndFeel()
public static void fitToDesktop(javax.swing.JFrame frame)
frame
-
|
Copyright 2006 Stanford University | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |