Modifier and Type | Class and Description |
---|---|
static class |
UiUtil.AlignX
Enumeration for horizontal alignment.
|
static class |
UiUtil.AlignY
Type-safe enumeration vertical alignment.
|
Constructor and Description |
---|
UiUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
alignAllX(Container aContainer,
UiUtil.AlignX aAlignment)
Imposes a uniform horizontal alignment on all items in a container.
|
static void |
alignAllY(Container aContainer,
UiUtil.AlignY aAlignment)
Imposes a uniform vertical alignment on all items in a container.
|
static void |
beep()
Make the system emit a beep.
|
static void |
centerAndShow(Window aWindow)
pack, center, and show a window on the screen.
|
static void |
centerOnParentAndShow(Window aWindow)
A window is packed, centered with respect to a parent, and then shown.
|
static ImageIcon |
createImageIcon(String aPath,
String aDescription,
Class aClass)
Create an icon for use by a given class.
|
static void |
equalizeSizes(List<JComponent> aComponents)
Sets the items in aComponents to the same size.
|
static Frame |
getActiveFrame()
Return the currently active frame.
|
static JComponent |
getCommandColumn(List<JComponent> aButtons)
Make a vertical row of buttons of equal size, whch are equally spaced,
and aligned on the right.
|
static JComponent |
getCommandRow(List<JComponent> aButtons)
Make a horizontal row of buttons of equal size, whch are equally spaced,
and aligned on the right.
|
static String |
getDialogTitle(String aSpecificDialogName)
Return text which conforms to the Look and Feel Design Guidelines
for the title of a dialog : the application name, a colon, then
the name of the specific dialog.
|
static Dimension |
getDimensionFromPercent(int aPercentWidth,
int aPercentHeight)
Return a Dimension whose size is defined not in terms of pixels,
but in terms of a given percent of the screen's width and height.
|
static Border |
getStandardBorder()
Return a border of dimensions recommended by the Java Look and Feel
Design Guidelines, suitable for many common cases.
|
static void |
noDefaultButton(JRootPane aRootPane)
Ensure that aRootPane has no default button associated with it.
|
public UiUtil()
public static void centerAndShow(Window aWindow)
If the size of aWindow exceeds that of the screen, then the size of aWindow is reset to the size of the screen.
public static void centerOnParentAndShow(Window aWindow)
This method is intended for dialogs only.
If centering with respect to a parent causes any part of the dialog to be off screen, then the centering is overidden, such that all of the dialog will always appear fully on screen, but it will still appear near the parent.
aWindow
- must have non-null result for aWindow.getParent.public static Border getStandardBorder()
Each side of the border has size UiConsts.STANDARD_BORDER
.
public static String getDialogTitle(String aSpecificDialogName)
Example return value: My Movies: Login
aSpecificDialogName
- must have visible contentpublic static JComponent getCommandRow(List<JComponent> aButtons)
The returned component has border spacing only on the top (of the size
recommended by the Look and Feel Design Guidelines).
All other spacing must be applied elsewhere ; usually, this will only mean
that the dialog's top-level panel should use getStandardBorder()
.
aButtons
- contains the buttons to be placed in a row.public static JComponent getCommandColumn(List<JComponent> aButtons)
The returned component has border spacing only on the left (of the size
recommended by the Look and Feel Design Guidelines).
All other spacing must be applied elsewhere ; usually, this will only mean
that the dialog's top-level panel should use getStandardBorder()
.
aButtons
- contains the buttons to be placed in a columnpublic static Frame getActiveFrame()
public static final Dimension getDimensionFromPercent(int aPercentWidth, int aPercentHeight)
Use to set the preferred size of a component to a certain percentage of the screen.
aPercentWidth
- percentage width of the screen, in range 1..100.aPercentHeight
- percentage height of the screen, in range 1..100.public static void equalizeSizes(List<JComponent> aComponents)
Sets each component's preferred and maximum sizes. The actual size is determined by the layout manager, whcih adjusts for locale-specific strings and customized fonts. (See this Sun doc for more information.)
aComponents
- items whose sizes are to be equalizedpublic static void beep()
May not beep unless the speakers are turned on, so this cannot be guaranteed to work.
public static void alignAllX(Container aContainer, UiUtil.AlignX aAlignment)
Intended especially for BoxLayout, where all components need to share the same alignment in order for display to be reasonable. (Indeed, this method may only work for BoxLayout, since apparently it is the only layout to use setAlignmentX, setAlignmentY.)
aContainer
- contains only JComponent objects.public static void alignAllY(Container aContainer, UiUtil.AlignY aAlignment)
Intended especially for BoxLayout, where all components need to share the same alignment in order for display to be reasonable. (Indeed, this method may only work for BoxLayout, since apparently it is the only layout to use setAlignmentX, setAlignmentY.)
aContainer
- contains only JComponent objects.public static void noDefaultButton(JRootPane aRootPane)
Intended mainly for dialogs where the user is confirming a delete action. In this case, an explicit Yes or No is preferred, with no default action being taken when the user hits the Enter key.
public static ImageIcon createImageIcon(String aPath, String aDescription, Class aClass)
aPath
- path to the file, relative to the calling class, as in '../images/blah.png'aDescription
- description of the imageaClass
- class that needs to use the imageCopyright Hirondelle Systems - Generated 2013Sep20.11.16