public class UIUtil extends Object implements SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST| Constructor and Description |
|---|
UIUtil() |
| Modifier and Type | Method and Description |
|---|---|
static SimpleAttributeSet |
getDefaultAttributeSet() |
static Font |
getFontOrDefault(String key) |
static Image |
getFrameImage(Icon icon) |
static Image |
getImage(Icon icon) |
static Image |
getImage(ImageIcon imageIcon) |
static void |
jGridBagAdd(JComponent parent,
Component componentToAdd,
GridBagConstraints constraints,
int pos)
Add a component to a container that is using a
GridBagLayout,
together with its constraints and the
GridBagConstraints.gridwidth value. |
static KeyStroke |
parseAcceleratorString(String string)
Parse a string in the format of [ALT+|CTRL+|SHIFT+]
|
static Integer |
parseMnemonicString(String string)
Parse a string in the format of
[character] to create an
Integer that may be used for an action. |
static void |
positionComponent(int p,
Component c)
Position a component on the screen (must be a
java.awt.Window to be useful) |
static void |
positionComponent(int p,
Component c,
Component o) |
static void |
positionComponent(int p,
Component c,
Rectangle d) |
static String |
rectangleToString(Rectangle rectangle)
Convert a
Rectangle object to a comma separated string in the
format of x,y,width,height. |
static Image |
scaleHeight(int height,
Image image,
ImageObserver observer) |
static Image |
scaleWidth(int width,
Image image,
ImageObserver observer) |
static void |
selectStringInList(String string,
JComboBox list)
Select an item in a
JComboBox given an items string value |
static void |
selectStringInList(String string,
JList list)
Select an item in a
JList given an items string value |
static void |
setIconImage(Dialog d,
Image image) |
static void |
showErrorMessage(Component parent,
String mesg,
String title,
Throwable exception)
Show an error message with toggable detail
|
static void |
showErrorMessage(Component parent,
String mesg,
String title,
Throwable exception,
boolean appendExceptionMessageToShortMessage)
Show an error message with toggable detail
|
static void |
showErrorMessage(Component parent,
String title,
Throwable exception)
Show an error message with detail
|
static Rectangle |
stringToRectangle(String string,
Rectangle defaultValue)
Convert a string in the format of
x,y,width,height in to a
Rectangle object. |
public static void selectStringInList(String string, JList list)
JList given an items string valuestring - string to select in listlist - listpublic static void selectStringInList(String string, JComboBox list)
JComboBox given an items string valuestring - string to select in listlist - listpublic static Rectangle stringToRectangle(String string, Rectangle defaultValue)
x,y,width,height in to a
Rectangle object. Suitable for retrieving rectangles from
property files, XML files etc. The supplied default value will be
returned if the string is not in the correct format or is
null.string - string in format x,y,width,heightdefaultValue - default rectanglepublic static String rectangleToString(Rectangle rectangle)
Rectangle object to a comma separated string in the
format of x,y,width,height. Suitable for storing
rectangles in property files, XML files etc.rectangle - rectanglepublic static Integer parseMnemonicString(String string)
[character] to create an
Integer that may be used for an action.character - mnemonic stringpublic static KeyStroke parseAcceleratorString(String string)
string - accelerator stringpublic static void jGridBagAdd(JComponent parent, Component componentToAdd, GridBagConstraints constraints, int pos)
GridBagLayout,
together with its constraints and the
GridBagConstraints.gridwidth value.parent - parent containercomponentToAdd - component to addconstraints - contraintspos - grid width positionIllegalArgumentExceptionpublic static void positionComponent(int p,
Component c)
java.awt.Window to be useful)p - postion from SwingConstantsc - componentpublic static void showErrorMessage(Component parent, String title, Throwable exception)
parent - title - exception - public static void showErrorMessage(Component parent, String mesg, String title, Throwable exception)
parent - mesg - title - exception - public static void showErrorMessage(Component parent, String mesg, String title, Throwable exception, boolean appendExceptionMessageToShortMessage)
parent - mesg - title - appenExceptionMessageToShortMessage - exception - public static Image scaleWidth(int width, Image image, ImageObserver observer)
public static Image scaleHeight(int height, Image image, ImageObserver observer)
public static SimpleAttributeSet getDefaultAttributeSet()
Copyright © 2021. All rights reserved.