public class GuiUtilFns
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
DEF_PAD_WIDTH
The default pad width for components that sometimes require it, such as
'JComboBox'.
|
static int |
DEF_SCREEN_HEIGHT
The default screen height
|
static int |
DEF_SCREEN_WIDTH
The default screen width
|
static char |
defaultWidthChar
The default width character, m.
|
| Modifier and Type | Method and Description |
|---|---|
static java.awt.Font |
createFont(java.lang.String name,
int style,
int size)
Create the font.
|
static void |
ensureRowVisible(javax.swing.JTable tableObj,
int row)
Ensures that the specified table row is visible.
|
static void |
ensureSelectionVisible(javax.swing.JTable tableObj)
Ensures that the current table selection is visible.
|
static java.awt.Dimension |
getDisplayScreenSize()
Returns a 'Dimension' object containing the size of the display screen.
|
static int |
getExtendedFrameState(java.awt.Frame frameObj)
Returns the "extended" state of the given frame.
|
static int |
getFrameMaximizedBothValue()
Returns the value of Frame.MAXIMIZED_BOTH.
|
static java.io.File |
getImageFile(java.awt.Component parent)
Get the image file.
|
static java.io.File |
getImageFile(java.awt.Component parent,
IstiFileFilter filter,
java.lang.String imageFormatDefault)
Get the image file.
|
static int |
getMaxCharWidth(java.awt.Component compObj)
Returns the maximum width, in pixels, of the default width character.
|
static int |
getMaxCharWidth(java.awt.Component compObj,
char widthChar)
Returns the maximum width, in pixels, of the specified width character.
|
static int |
getMaxCharWidth(java.awt.Component compObj,
java.lang.String specialChars,
boolean allowedFlag)
Returns the maximum width, in pixels, of an allowed character.
|
static int |
getMaxCharWidth(java.awt.Component compObj,
com.isti.util.gui.textvalidator.TextValidator tv)
Returns the maximum width, in pixels, of an allowed character.
|
static IstiNamedValue |
getMaxCharWidthValue(java.awt.Component compObj,
java.lang.String specialChars,
boolean allowedFlag)
Returns the maximum width, in pixels, of an allowed character.
|
static java.awt.Rectangle |
getMaximumWindowBounds()
Returns the maximum bounds for centered windows.
|
static java.util.List |
getSelectedValuesList(javax.swing.JList listObj)
Get the selected values.
|
static java.util.List |
getSelectedValuesList(javax.swing.JList listObj,
java.util.List selectedValues)
Get the selected values.
|
static java.lang.String |
getSpacerStrForWidth(int widthVal,
java.awt.Component compObj)
Generates a spacer string containing the maximum number of space characters
that will fit within the given pixel width, using the given component.
|
static java.lang.String |
getSpacerStrForWidth(int widthVal,
java.awt.Component compObj,
java.awt.Font fontObj)
Generates a spacer string containing the maximum number of space characters
that will fit within the given pixel width, using the given component and
font.
|
static java.lang.String |
getSpacerStrForWidth(int widthVal,
java.awt.Component compObj,
java.awt.Font fontObj,
int defWidthVal)
Generates a spacer string containing the maximum number of space characters
that will fit within the given pixel width, using the given component and
font.
|
static java.lang.String |
getSpacerStrForWidth(int widthVal,
java.awt.Component compObj,
int defWidthVal)
Generates a spacer string containing the maximum number of space characters
that will fit within the given pixel width, using the given component.
|
static java.lang.String |
getSpacerStrForWidth(int widthVal,
int spaceCharSize)
Generates a spacer string containing the maximum number of space characters
that will fit within the given pixel width.
|
static int |
getStringWidth(java.awt.Component compObj,
java.awt.Font fontObj,
java.lang.String str)
Returns the width, in pixels, of the given string.
|
static int |
getStringWidth(java.awt.Component compObj,
java.awt.Font fontObj,
java.lang.String str,
int defWidthVal)
Returns the width, in pixels, of the given string.
|
static int |
getStringWidth(java.awt.Component compObj,
java.lang.String str)
Returns the width, in pixels, of the given string.
|
static int |
getStringWidth(java.awt.Component compObj,
java.lang.String str,
int defWidthVal)
Returns the width, in pixels, of the given string.
|
static int |
getStringWidth(java.awt.Font fontObj,
java.lang.String str)
Returns the width, in pixels, of the given string.
|
static int |
getStringWidth(java.awt.Font fontObj,
java.lang.String str,
int defWidthVal)
Returns the width, in pixels, of the given string.
|
static int |
getStringWidth(java.lang.String str)
Returns the width, in pixels, of the given string.
|
static int |
getStringWidth(java.lang.String str,
int defWidthVal)
Returns the width, in pixels, of the given string.
|
static void |
initColumnSizes(javax.swing.JTable tableObj) |
static boolean |
isFrameMaximized(java.awt.Frame frameObj)
Determines if the given frame is maximized (both horizontally and
vertically).
|
static boolean |
maximizeFrame(java.awt.Frame frameObj)
Sets the state of the given frame to "maximized" (both horizontally and
vertically).
|
static void |
saveImage(java.io.File file,
java.awt.Component... components)
Save the image to the specified file.
|
static void |
setButtonsContentAreaFilled(java.awt.Container contObj,
boolean flgVal)
Calls the 'setContentAreaFilled()' method on all button objects held by the
given container or any subcontainers of it.
|
static void |
setEmptyJListWidth(javax.swing.JList listObj,
int widthVal)
Sets the fixed cell width that the given 'JList' is to have when its
contents are empty.
|
static boolean |
setExtendedFrameState(java.awt.Frame frameObj,
int stateVal)
Sets the "extended" state of the given frame.
|
static boolean |
setPreferredSize(java.awt.Component compObj,
java.awt.Dimension dimObj)
Sets the preferred size of the given component to a constant value.
|
static void |
setPreferredSize(java.awt.Component compObj,
int maxNumChars,
int maxCharWidth)
Set the preferred size for the component.
|
static void |
setPreferredSize(java.awt.Component compObj,
int maxNumChars,
int maxCharWidth,
int padWidth)
Set the preferred size for the component.
|
static void |
setPreferredSize(java.awt.Component compObj,
com.isti.util.gui.textvalidator.TextValidator tv)
Set the preferred size for the component.
|
static void |
setPreferredSize(javax.swing.JComponent compObj,
int maxNumChars)
Set the preferred size for the component.
|
static void |
setScrollPaneCentered(javax.swing.JScrollPane paneObj)
Sets the given scroll-pane to have its scroll-bars centered.
|
public static int DEF_PAD_WIDTH
public static final int DEF_SCREEN_HEIGHT
public static final int DEF_SCREEN_WIDTH
public static final char defaultWidthChar
public static java.awt.Font createFont(java.lang.String name,
int style,
int size)
name - the font name or null for the default label font name.style - the style or -1 for the default label font style.size - the size or -1 for the default label font size.public static void ensureRowVisible(javax.swing.JTable tableObj,
int row)
tableObj - the table object.row - the row index.public static void ensureSelectionVisible(javax.swing.JTable tableObj)
tableObj - the table object.public static java.awt.Dimension getDisplayScreenSize()
public static int getExtendedFrameState(java.awt.Frame frameObj)
frameObj - 'Frame' object to use.public static int getFrameMaximizedBothValue()
public static java.io.File getImageFile(java.awt.Component parent)
parent - the parent or null if none.public static java.io.File getImageFile(java.awt.Component parent,
IstiFileFilter filter,
java.lang.String imageFormatDefault)
parent - the parent or null if none.filter - the filter.imageFormatDefault - the image format default.public static int getMaxCharWidth(java.awt.Component compObj)
compObj - the component to use.public static int getMaxCharWidth(java.awt.Component compObj,
char widthChar)
compObj - the component to use.widthChar - the width character.public static int getMaxCharWidth(java.awt.Component compObj,
java.lang.String specialChars,
boolean allowedFlag)
compObj - the component to use.specialChars - the allowed (or not allowed) special characters.allowedFlag - true to allow only the special characters, false to not
allow the special characters.public static int getMaxCharWidth(java.awt.Component compObj,
com.isti.util.gui.textvalidator.TextValidator tv)
compObj - the component to use.tv - the text validator.public static IstiNamedValue getMaxCharWidthValue(java.awt.Component compObj, java.lang.String specialChars, boolean allowedFlag)
compObj - the component to use.specialChars - the allowed (or not allowed) special characters.allowedFlag - true to allow only the special characters, false to not
allow the special characters.public static java.awt.Rectangle getMaximumWindowBounds()
public static java.util.List getSelectedValuesList(javax.swing.JList listObj)
listObj - the 'JList' to use.public static java.util.List getSelectedValuesList(javax.swing.JList listObj,
java.util.List selectedValues)
NOTE: If a selected values list is provided it is not cleared prior to adding values.
listObj - the 'JList' to use.selectedValues - the selected values list to add selected values to or
null to create a new list if needed.public static java.lang.String getSpacerStrForWidth(int widthVal,
java.awt.Component compObj)
widthVal - the pixel width to use.compObj - the component to use, or null to use a default 'JLabel'
object.public static java.lang.String getSpacerStrForWidth(int widthVal,
java.awt.Component compObj,
java.awt.Font fontObj)
widthVal - the pixel width to use.compObj - the component to use, or null to use a default 'JLabel'
object.fontObj - the font to use, or null to use the font from the given
component object.public static java.lang.String getSpacerStrForWidth(int widthVal,
java.awt.Component compObj,
java.awt.Font fontObj,
int defWidthVal)
widthVal - the pixel width to use.compObj - the component to use, or null to use a default 'JLabel'
object.fontObj - the font to use, or null to use the font from the given
component object.defWidthVal - a default width value for the size of space character in
pixels (used if an error occurs while determining the
size).public static java.lang.String getSpacerStrForWidth(int widthVal,
java.awt.Component compObj,
int defWidthVal)
widthVal - the pixel width to use.compObj - the component to use, or null to use a default 'JLabel'
object.defWidthVal - a default width value for the size of space character in
pixels (used if an error occurs while determining the
size).public static java.lang.String getSpacerStrForWidth(int widthVal,
int spaceCharSize)
widthVal - the pixel width to use.spaceCharSize - the size (in pixels) of a space character to use, or 0
to use a default size.public static int getStringWidth(java.awt.Component compObj,
java.awt.Font fontObj,
java.lang.String str)
NOTE: This width can change, for example if the component is moved from one display to another.
compObj - the component to use, or null to use a default 'JLabel'
object.fontObj - the font to use, or null to use the font from the given
component object.str - the string to use.public static int getStringWidth(java.awt.Component compObj,
java.awt.Font fontObj,
java.lang.String str,
int defWidthVal)
NOTE: This width can change, for example if the component is moved from one display to another.
compObj - the component to use, or null to use a default 'JLabel'
object.fontObj - the font to use, or null to use the font from the given
component object.str - the string to use.defWidthVal - a default width value to be returned if an error occurs
while calculating the width.public static int getStringWidth(java.awt.Component compObj,
java.lang.String str)
NOTE: This width can change, for example if the component is moved from one display to another.
compObj - the component to use, or null to use a default 'JLabel'
object.str - the string to use.public static int getStringWidth(java.awt.Component compObj,
java.lang.String str,
int defWidthVal)
NOTE: This width can change, for example if the component is moved from one display to another.
compObj - the component to use, or null to use a default 'JLabel'
object.str - the string to use.defWidthVal - a default width value to be returned if an error occurs
while calculating the width.public static int getStringWidth(java.awt.Font fontObj,
java.lang.String str)
fontObj - the font to use, or null to use the font from the given
component object.str - the string to use.public static int getStringWidth(java.awt.Font fontObj,
java.lang.String str,
int defWidthVal)
fontObj - the font to use, or null to use the font from the given
component object.str - the string to use.defWidthVal - a default width value to be returned if an error occurs
while calculating the width.public static int getStringWidth(java.lang.String str)
str - the string to use.public static int getStringWidth(java.lang.String str,
int defWidthVal)
str - the string to use.defWidthVal - a default width value to be returned if an error occurs
while calculating the width.public static void initColumnSizes(javax.swing.JTable tableObj)
public static boolean isFrameMaximized(java.awt.Frame frameObj)
frameObj - 'Frame' object to use.public static boolean maximizeFrame(java.awt.Frame frameObj)
frameObj - 'Frame' object to use.public static void saveImage(java.io.File file,
java.awt.Component... components)
throws java.io.IOException
file - the file.components - the components.java.io.IOException - if an error occurs during writing.public static void setButtonsContentAreaFilled(java.awt.Container contObj,
boolean flgVal)
contObj - container to use.flgVal - true for content filled; false for not.public static void setEmptyJListWidth(javax.swing.JList listObj,
int widthVal)
listObj - the 'JList' to use.widthVal - the width value to use.public static boolean setExtendedFrameState(java.awt.Frame frameObj,
int stateVal)
frameObj - 'Frame' object to use.stateVal - frame-state-bitmap value to use.public static boolean setPreferredSize(java.awt.Component compObj,
java.awt.Dimension dimObj)
compObj - 'Component' object to use.dimObj - The new preferred size, or null.public static final void setPreferredSize(java.awt.Component compObj,
int maxNumChars,
int maxCharWidth)
compObj - the component.maxNumChars - the maximum number of characters.maxCharWidth - the maximum character width.public static final void setPreferredSize(java.awt.Component compObj,
int maxNumChars,
int maxCharWidth,
int padWidth)
compObj - the component.maxNumChars - the maximum number of characters.maxCharWidth - the maximum character width.padWidth - the pad width or 0 if none.public static final void setPreferredSize(java.awt.Component compObj,
com.isti.util.gui.textvalidator.TextValidator tv)
compObj - the component.tv - the text validator.public static final void setPreferredSize(javax.swing.JComponent compObj,
int maxNumChars)
compObj - the component.maxNumChars - the maximum number of characters.public static void setScrollPaneCentered(javax.swing.JScrollPane paneObj)
paneObj - the scroll-pane object to use.