|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jdesktop.swingx.util.WindowUtils
public final class WindowUtils
Encapsulates various utilities for windows (ie: Frame
and
Dialog
objects and descendants, in particular).
Nested Class Summary | |
---|---|
static class |
WindowUtils.MinSizeComponentListener
Resets window size to minSize if needed. |
Method Summary | |
---|---|
static javax.swing.JDialog |
findJDialog(java.awt.Component c)
Locates the JDialog for the given component |
static javax.swing.JFrame |
findJFrame(java.awt.Component c)
Locates the JFrame for the given component |
static javax.swing.RootPaneContainer |
findRootPaneContainer(java.awt.Component c)
Locates the RootPaneContainer for the given component |
static java.awt.Window |
findWindow(java.awt.Component c)
|
static java.util.List<java.awt.Component> |
getAllComponents(java.awt.Container c)
|
static java.awt.Point |
getPointForCentering(javax.swing.JInternalFrame window)
Returns the Point at which a window should be placed to
center that window on the given desktop. |
static java.awt.Point |
getPointForCentering(java.awt.Window window)
Returns the Point at which a window should be placed to
center that window on the screen. |
static java.awt.Point |
getPointForStaggering(java.awt.Window originWindow)
Returns the Point at which a window should be placed in
order to be staggered slightly from another "origin" window to
ensure that the title areas of both windows remain visible to the user. |
static java.awt.Rectangle |
getRectangle(javax.swing.JComponent comp)
Get a Rectangle object representing the given JComponent's position and
magnitude in space. |
static java.awt.Rectangle |
getRectangle(java.awt.Window win)
Get a Rectangle object representing the given window's position and
magnitude in space. |
static void |
setConstraints(java.awt.GridBagConstraints gbc,
int gridx,
int gridy,
int gridwidth,
int gridheight,
double weightx,
double weighty,
int anchor,
int fill,
int top,
int left,
int bottom,
int right)
Utility method used to load a GridBagConstraints object (param gbc) with the data in the other parameters. |
static void |
setFontRecursively(java.awt.Container c,
java.awt.Font font)
|
static void |
setMinimumSizeManager(java.awt.Window window,
int minWidth,
int minHeight)
Installs/resets a ComponentListener to resize the given window to minWidth/Height if needed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static java.awt.Point getPointForCentering(java.awt.Window window)
Point
at which a window should be placed to
center that window on the screen.
Some thought was taken as to whether to implement a method such as this,
or to simply make a method that, given a window, will center it. It was
decided that it is better to not alter an object within a method.
window
- The window to calculate the center point for. This object
can not be null.
Point
at which the window should be placed to
center that window on the screen.public static java.awt.Point getPointForCentering(javax.swing.JInternalFrame window)
Point
at which a window should be placed to
center that window on the given desktop.
Some thought was taken as to whether to implement a method such as this,
or to simply make a method that, given a window, will center it. It was
decided that it is better to not alter an object within a method.
window
- The window (JInternalFrame) to calculate the center point
for. This object can not be null.
Point
at which the window should be placed to
center that window on the given desktoppublic static java.awt.Point getPointForStaggering(java.awt.Window originWindow)
Point
at which a window should be placed in
order to be staggered slightly from another "origin" window to
ensure that the title areas of both windows remain visible to the user.
originWindow
- Window from which the staggered location will be calculated
public static void setConstraints(java.awt.GridBagConstraints gbc, int gridx, int gridy, int gridwidth, int gridheight, double weightx, double weighty, int anchor, int fill, int top, int left, int bottom, int right)
public static java.awt.Rectangle getRectangle(java.awt.Window win)
Rectangle
object representing the given window's position and
magnitude in space.
win
- The window to get a Rectangle object for
public static java.awt.Rectangle getRectangle(javax.swing.JComponent comp)
Rectangle
object representing the given JComponent's position and
magnitude in space.
comp
- The JComponent to get a Rectangle object for
public static javax.swing.RootPaneContainer findRootPaneContainer(java.awt.Component c)
c
-
public static javax.swing.JFrame findJFrame(java.awt.Component c)
c
-
public static javax.swing.JDialog findJDialog(java.awt.Component c)
c
-
public static java.awt.Window findWindow(java.awt.Component c)
public static java.util.List<java.awt.Component> getAllComponents(java.awt.Container c)
public static void setFontRecursively(java.awt.Container c, java.awt.Font font)
public static void setMinimumSizeManager(java.awt.Window window, int minWidth, int minHeight)
window
- minWidth
- minHeight
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |