|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.crosswire.common.swing.GuiUtil
public final class GuiUtil
Various GUI Utilities.
for license details.
The copyright to this program is held by it's authors.
Field Summary | |
---|---|
private static org.slf4j.Logger |
log
The log stream |
Constructor Summary | |
---|---|
private |
GuiUtil()
Prevent instantiation |
Method Summary | |
---|---|
static void |
applyDefaultOrientation(Component comp)
Recursively apply default component orientation to the component and all it contains. |
static void |
applyOrientation(Component comp,
boolean ltr)
Recursively apply component orientation to the component and all it contains. |
static void |
applyOrientation(Component comp,
ComponentOrientation orientation)
Recursively apply component orientation to the component and all it contains. |
static void |
centerOnScreen(Window win)
Move the specified window to the center of the screen. |
static void |
defaultDesktopSize(Window win)
Set the size of the main window to a default size. |
static void |
enforceMinimumSize(Component comp,
int min_width,
int min_height)
Set the size of a component |
static JButton |
flatten(JButton button)
|
static Dialog |
getDialog(Component com)
Find the parent Frame |
static Frame |
getFrame(Component parent)
Find the parent Frame. |
static ImageIcon |
getIcon(String name)
Returns the Icon associated with the name from the resources. |
static Frame |
getRootFrame()
Find the best frame to which to root a dialog, generally the largest visible frame of the application. |
static String |
getText(Component comp)
Attempts to get the text from a generic Component. |
static Window |
getWindow(Component com)
Find the parent window. |
static void |
maximizeWindow(Window win)
Maximize the specified window. |
static void |
refresh(Component c)
Cause a component to refresh its contents when it is changed by the program and needs to be redrawn. |
static void |
restrainedPack(Window win,
float maxx,
float maxy)
A more restricted version of pack() when the component is being pack()ed for the first time. |
static void |
restrainedRePack(Window win)
A more restricted version of pack() for component responding to live component tweaks. |
static int |
setSize(Window win,
Dimension requestedDim)
Set the size of the window, but no bigger than the screen. |
static void |
setSize(Window win,
float percentOfScreen)
Set the window size relative to the current screen size. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final org.slf4j.Logger log
Constructor Detail |
---|
private GuiUtil()
Method Detail |
---|
public static ImageIcon getIcon(String name)
name
- Name of the icon file i.e., help16.gif
public static Window getWindow(Component com)
com
- a component to find the frame of.
public static Frame getRootFrame()
public static Frame getFrame(Component parent)
parent
- a component to find the frame of.
public static Dialog getDialog(Component com)
com
- a component to find the frame of.
public static void centerOnScreen(Window win)
win
- The window to be movedpublic static int setSize(Window win, Dimension requestedDim)
On platforms that allow docking of other windows, this routine does not take that into account for sizes that are near that of the screen. For example, on Windows XP, the user may have a task bar showing permanently on one side of the screen and another application's toolbar on another side of the screen. If the requested size of the window is less than the screen size in a particular dimension, it will not be able to adjust for it.
For that reason, either have the application significantly smaller than the screen size or maximize the window.
win
- the window to resizerequestedDim
- how wide and tall to make the window, if possible
public static void setSize(Window win, float percentOfScreen)
win
- The window to resizepercentOfScreen
- The amount of space that the window should take uppublic static void defaultDesktopSize(Window win)
win
- The window to resizepublic static void maximizeWindow(Window win)
win
- The window to be movedpublic static void refresh(Component c)
c
- the component to refreshpublic static void restrainedRePack(Window win)
win
- The window to be packedpublic static void restrainedPack(Window win, float maxx, float maxy)
win
- The window to be packedmaxx
- The maximum fraction (0.0 to 1.0) of the screen to be taken up
horizontallymaxy
- The maximum fraction (0.0 to 1.0) of the screen to be taken up
verticallyrestrainedRePack(Window)
public static void enforceMinimumSize(Component comp, int min_width, int min_height)
public static String getText(Component comp)
comp
- The object containing the needed text.public static void applyDefaultOrientation(Component comp)
comp
- the root of the tree to which orientation needs to be appliedpublic static void applyOrientation(Component comp, boolean ltr)
comp
- the root of the tree to which orientation needs to be appliedltr
- whether the orientation is left to right or not.public static void applyOrientation(Component comp, ComponentOrientation orientation)
comp
- the root of the tree to which orientation needs to be appliedorientation
- the orientation to be appliedpublic static JButton flatten(JButton button)
|
Copyright ? 2003-2011 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |