|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.tensegrity.gui.swing.SwingUtil
This class consists of common swing utility methods. This is the place for small convenience methods which should not be duplicated in every place they are needed. This class provides all sorts of methods involving Control creation, Layout helpers and message boxes.
| Nested Class Summary | |
static class |
SwingUtil.ActionCommand
An Action-delegate class. |
static class |
SwingUtil.ChoiceCommandMenuItem
Subclass of JMenuItem to delegate the isEnabled call to the command and the isSelected() to the ToggleCommand. |
static interface |
SwingUtil.CommandItem
The CommandItem encapsulates the basic behavior for an
item which is associated to a Command. |
static class |
SwingUtil.CommandMenuItem
Subclass of JMenuItem to delegate the isEnabled call to the command. |
static class |
SwingUtil.CommandToggleButton
Subclass of JToggleButton to delegate the isSelected call to the command and the isSelected() to the ToggleCommand. |
static class |
SwingUtil.ToggleCommandMenuItem
Subclass of JMenuItem to delegate the isEnabled call to the command and the isSelected() to the ToggleCommand. |
| Field Summary | |
static int |
CANCEL
Global flags that identify options for buttons in dialogs. |
static int |
CLOSED
Global flags that identify options for buttons in dialogs. |
static java.lang.String |
DEFAULT_ICON
This is a custom property for swing actions which defines a default icon, which should be used for LnF's different from the Tensegrity LnF. |
static int |
HORIZONTAL_POSITIONHINT_CENTER
Horizontal positionhints for dialog showing. |
static int |
HORIZONTAL_POSITIONHINT_LEFT
Horizontal positionhints for dialog showing. |
static int |
HORIZONTAL_POSITIONHINT_RIGHT
Horizontal positionhints for dialog showing. |
static java.awt.Insets |
insDefault
The default insets used in dialog layouts |
static char |
MNEMONIC_INDICATOR
Character representing the mnemonic indicator to be used when adding mnemonics to Menus and Menu Items. |
static int |
NO
Global flags that identify options for buttons in dialogs. |
static java.lang.String |
TENSEGRITY_ICON
The name of the property which holds the icon for the Tensegrity LookAndFeel. |
static int |
VERTICAL_POSITIONHINT_BOTTOM
Vertical positionhints for dialog showing. |
static int |
VERTICAL_POSITIONHINT_CENTER
Vertical positionhints for dialog showing. |
static int |
VERTICAL_POSITIONHINT_TOP
Vertical positionhints for dialog showing. |
static int |
YES
Global flags that identify options for buttons in dialogs. |
| Method Summary | |
static void |
addComponent(java.awt.Container container,
java.awt.Component component,
int fill,
int gX,
int gY,
int gW,
int gH,
double wX,
double wY)
Adds a component to the container which must have gridbag layout. |
static void |
addComponent(java.awt.Container container,
java.awt.Component component,
int fill,
int gX,
int gY,
int gW,
int gH,
double wX,
double wY,
java.awt.Insets insets)
Adds a component to the container which must have gridbag layout. |
static void |
addToGridBagLayout(java.awt.Container container,
java.awt.Component component,
int fill,
int gX,
int gY,
int gW,
int gH,
double wX,
double wY)
add the given Component to the
GridBagLayout |
static void |
addToGridBagLayout(java.awt.Container container,
java.awt.Component component,
int fill,
int gX,
int gY,
int gW,
int gH,
double wX,
double wY,
java.awt.Insets insets)
add the given Component to the
GridBagLayout |
static void |
addToGridBagLayout(java.awt.Container container,
java.awt.Component component,
int fill,
int gX,
int gY,
int gW,
int gH,
double wX,
double wY,
int anchor)
add the given Component to the
GridBagLayout |
static javax.swing.JMenuItem |
addToMenu(javax.swing.JMenu menu,
java.util.HashMap uiMap,
java.lang.String id,
Command command,
javax.swing.KeyStroke ks,
java.lang.String iconurl,
java.lang.Class resourceClass,
UIManager uiManager)
Creates a menu item and adds it to the specified menu. |
static javax.swing.JMenuItem |
addToMenu(javax.swing.JMenu menu,
java.util.HashMap uiMap,
java.lang.String id,
Command command,
javax.swing.KeyStroke ks,
UIManager uiManager)
Creates a menu item and adds it to the specified menu. |
static javax.swing.JMenuItem |
addToMenu(javax.swing.JMenu menu,
java.util.HashMap uiMap,
java.lang.String id,
Command command,
java.lang.String iconurl,
java.lang.Class resourceClass,
UIManager uiManager)
Creates a menu item and adds it to the specified menu. |
static javax.swing.JMenuItem |
addToMenu(javax.swing.JMenu menu,
java.util.HashMap uiMap,
java.lang.String id,
Command command,
UIManager uiManager)
Creates a menu item and adds it to the specified menu. |
static javax.swing.JMenuItem |
addToMenu(javax.swing.JMenu menu,
java.util.HashMap uiMap,
java.lang.String id,
Command command,
UIManager uiManager,
javax.swing.Icon icon)
Creates a menu item and adds it to the specified menu. |
static javax.swing.JMenuItem |
addToMenu(javax.swing.JPopupMenu menu,
java.util.HashMap uiMap,
java.lang.String id,
Command command,
javax.swing.KeyStroke ks,
java.lang.String iconurl,
java.lang.Class resourceClass,
UIManager uiManager)
Creates a menu item and adds it to the specified menu. |
static javax.swing.JMenuItem |
addToMenu(javax.swing.JPopupMenu menu,
java.util.HashMap uiMap,
java.lang.String id,
Command command,
javax.swing.KeyStroke ks,
java.lang.String iconurl,
java.lang.String rollovericonurl,
java.lang.Class resourceClass,
UIManager uiManager)
Creates a menu item and adds it to the specified menu. |
static javax.swing.JMenuItem |
addToMenu(javax.swing.JPopupMenu menu,
java.util.HashMap uiMap,
java.lang.String id,
Command command,
javax.swing.KeyStroke ks,
UIManager uiManager)
Creates a menu item and adds it to the specified menu. |
static javax.swing.JMenuItem |
addToMenu(javax.swing.JPopupMenu menu,
java.util.HashMap uiMap,
java.lang.String id,
Command command,
java.lang.String iconurl,
java.lang.Class resourceClass,
UIManager uiManager)
Creates a menu item and adds it to the specified menu. |
static javax.swing.JMenuItem |
addToMenu(javax.swing.JPopupMenu menu,
java.util.HashMap uiMap,
java.lang.String id,
Command command,
UIManager uiManager)
Creates a menu item and adds it to the specified menu. |
static javax.swing.AbstractButton |
addToToolBar(UIManager uiManager,
javax.swing.JToolBar toolbar,
Command command,
Icon icon)
Method addToToolbar adds a given command as item to the given toolbar. |
static javax.swing.AbstractButton |
addToToolBar(UIManager uiManager,
javax.swing.JToolBar toolbar,
Command command,
java.lang.String iconurl,
java.lang.Class resourceClass)
Method addToToolbar adds a given command as item to the given ToolBar. |
static javax.swing.AbstractButton |
addToToolBar(UIManager uiManager,
javax.swing.JToolBar toolbar,
Command command,
java.lang.String iconurl,
java.lang.String deficonurl,
java.lang.Class resourceClass)
Method addToToolbar adds a given command as item to the given toolbar. |
static javax.swing.JToggleButton |
addToToolBarToggleButton(UIManager uiManager,
javax.swing.JToolBar toolbar,
Command command,
Icon icon,
Icon iconToggled,
int index)
Method addToToolbar inserts a given command as item at a specific index of the toolbar. |
static javax.swing.JToggleButton |
addToToolBarToggleButton(UIManager uiManager,
javax.swing.JToolBar toolbar,
Command command,
java.lang.String iconurl,
java.lang.Class resourceClass)
Adds a new togglebutton to the given toolbar. |
static javax.swing.JToggleButton |
addToToolBarToggleButton(UIManager uiManager,
javax.swing.JToolBar toolbar,
Command command,
java.lang.String iconurl,
java.lang.String iconurlToggled,
java.lang.Class resourceClass)
Adds a new togglebutton to the given toolbar. |
static javax.swing.JToggleButton |
addToToolBarToggleButton(UIManager uiManager,
javax.swing.JToolBar toolbar,
Command command,
java.lang.String iconurl,
java.lang.String iconurlToggled,
java.lang.Class resourceClass,
int index)
Method addToToolbar inserts a given command as item at a specific index of the toolbar. |
static void |
alignMenuItems(javax.swing.JComponent menu)
This method aligns all MenuElements of the given Menu
Component evenly according to a "normal" MenuItem with an Icon. |
static void |
busyEnd(java.awt.Component busyComponent)
Decreases the busy counter of the given component and sets the default cursor, if the counter reaches 0. |
static void |
busyStart(java.awt.Component busyComponent)
Sets the busy cursor on the given component. |
static boolean |
canWriteFormat(java.lang.String formatName)
Returns true if the specified format name can be written |
static javax.swing.Action |
commandToAction(Command command)
The method commandToAction returns a swing action instance for a given generic command. |
static javax.swing.Action |
commandToAction(Command command,
UIManager uiManager)
Wraps a command into an action, so that it can be used in the world of swing. |
static javax.swing.JPanel |
createList(java.awt.Component[] comps)
Creates a List of components along the Y-Axis. |
static javax.swing.JPanel |
createTable(java.awt.Component[] left,
java.awt.Component[] right)
Creates a panel with GridBagLayout which layouts the given JComponent arrays like a table, where the left[] is the column 0 and the right the column 1. |
static javax.swing.border.Border |
createTitleFrameBorder(java.lang.String title,
int top,
int left,
int bottom,
int right)
Method createTitleFrameBorder creates a compound border consisting of 3 Borders: A titled border with default text alignment and font, an etched border for grouping effect and an emptyborder to have some insets. |
static javax.swing.JToggleButton |
createToggleButton(javax.swing.AbstractAction action,
ToggleCommand command)
Creates a toggle button, that changes its state according to the state of the togglecommand. |
static void |
doWhenVisible(java.awt.Component component,
java.lang.Runnable runnable)
Runs the Runnable when the given component got a valid size. |
static void |
drawString(javax.swing.JComponent comp,
java.awt.Graphics2D g2d,
java.lang.String str)
Draws the given string antialiased and centered into the graphics. |
static void |
drawString(javax.swing.JComponent comp,
java.awt.Graphics2D g2d,
java.lang.String str,
java.awt.Insets additionalInsets)
Draws the given string antialiased and centered into the graphics. |
static void |
dumpComponentTree(java.awt.Component component)
Dumps the swing component tree starting at the given root component. |
static java.awt.Rectangle |
findBounds(java.awt.Component component)
Finds the coordinates of the component in the given container. |
static java.awt.Point |
findCenterPointOnScreen(java.awt.Component component)
Finds the coordinates of the component in the given container. |
static java.awt.Component |
findChild(java.awt.Container cont,
java.lang.Class type)
Returns the first child matching the given class type |
static java.awt.Component |
findRoot(java.awt.Component component)
Finds the most top-level parent of a given component. |
static java.awt.Component |
findRoot(java.awt.Component component,
java.lang.Class constraint)
Finds the most top-level parent of a given component. |
static int |
getIndexOfMnemonic(java.lang.String text)
Returns the first index of an unquoted mnemonic indiacator. |
static javax.swing.JPanel |
getLabelPanel(int align)
Creates Panel with FlowLayout, for good looking value-labels |
static javax.swing.JPanel |
getLabelPanel(int align,
int hgap,
int vgap)
Creates Panel with FlowLayout.RIGHT, for good looking value-labels |
static java.awt.Rectangle |
getMaximumWindowBounds()
Returns the maximum rectangle that can be used for windows |
static int |
getMouseButton(java.awt.event.MouseEvent event)
Returns the mouse button from the given MouseEvent |
static javax.swing.MenuElement |
getPopupMenu()
|
static Icon |
getResourceIcon(java.lang.String iconurl,
java.lang.Class resourceclass,
java.awt.Component component,
boolean trackResource)
Loads an icon. |
static java.awt.Image |
getResourceImage(java.lang.String iconpath,
java.lang.Class resourceclass)
Loads an icon manually, without URL resolving. |
static java.awt.Image |
getResourceImage(java.lang.String iconpath,
java.lang.Class resourceclass,
java.awt.Component component,
boolean trackResource)
Loads an icon manually, without URL resolving. |
static java.awt.Color |
getUIColor(java.lang.Object key)
Returns the color with the given key from the current look and feel or a defaultColor if the entry does not exist.
|
static java.awt.Color |
getUIColor(java.lang.Object key,
java.awt.Color defaultColor)
Returns the color with the given key from the current look and feel or the defaultColor if the entry does not exist.
|
static boolean |
isTensegrityLookAndFeel()
Checks whether the current look and feel is the tensegrity look and feel or not |
static javax.swing.JCheckBoxMenuItem |
makeCheckBoxMenuItem(java.lang.String title,
java.awt.event.ItemListener listener)
This methods makes a new checkbox menuitem and assigns an action to it in one go. |
static javax.swing.JCheckBoxMenuItem |
makeCheckBoxMenuItem(java.lang.String title,
java.lang.String actionCommand,
javax.swing.Action action)
Makes a checkbox menu item. |
static javax.swing.JCheckBoxMenuItem |
makeCheckBoxMenuItemSelected(java.lang.String title,
java.awt.event.ItemListener listener)
This methods makes a new checkbox menuitem and assigns an action to it in one go. |
static javax.swing.JPanel |
makeCloseApplyButtonPanel(java.awt.event.ActionListener applyaction,
java.awt.event.ActionListener closeaction,
UIManager uiManager)
Creates a panel with an apply and a close button. |
static javax.swing.JPanel |
makeCloseButtonPanel(java.awt.event.ActionListener closeaction,
UIManager uiManager)
Creates a panel with a close button. |
static javax.swing.JPanel |
makeEmbeddedComponent(java.awt.Component component)
Creates a panel with a component that is to be left aligned under all size situations. |
static javax.swing.JPanel |
makeImportExportButtonPanel(java.awt.event.ActionListener importaction,
java.awt.event.ActionListener Exportaction,
UIManager uiManager)
Creates a panel with an import and an exportbutton. |
static javax.swing.JMenuItem |
makeMenuItem(java.lang.String id,
Command command,
javax.swing.KeyStroke ks,
UIManager uiManager)
Simple helper to create menuitems based on GUI ID's. |
static javax.swing.JMenuItem |
makeMenuItem(java.lang.String id,
Command command,
UIManager uiManager)
Simple helper to create menuitems based on GUI ID's without a key accelerator. |
static javax.swing.JMenuItem |
makeMenuItem(UIManager uiManager,
java.lang.String title,
java.lang.String actionCommand,
Command command)
This methods makes a new menu item and assigns an action to it in one go. |
static javax.swing.JMenuItem |
makeMenuItem(UIManager uiManager,
java.lang.String title,
java.lang.String actionCommand,
Command command,
javax.swing.KeyStroke accelerator)
This methods makes a new menu item and assigns an action to it in one go. |
static javax.swing.JPanel |
makeOkCancelApplyButtonPanel(java.awt.event.ActionListener okaction,
java.awt.event.ActionListener cancelaction,
java.awt.event.ActionListener applyaction,
UIManager uiManager)
Creates a panel with a cancel and an ok button. |
static javax.swing.JPanel |
makeOkCancelButtonPanel(java.awt.event.ActionListener okaction,
java.awt.event.ActionListener cancelaction,
UIManager uiManager)
Creates a panel with a cancel and an ok button. |
static javax.swing.JRadioButtonMenuItem |
makeRadioButtonMenuItem(javax.swing.ButtonGroup buttongroup,
java.lang.String title,
javax.swing.Action action)
This methods makes a new radiobutton menuitem and assigns an action to it in one go. |
static javax.swing.JPanel |
makeTitlePanel(java.lang.String text)
Creates a panel with a jlabel that is typically used as a title for a dialog or other container. |
static void |
paintClosingLine(java.awt.Graphics g,
java.awt.Dimension d)
Paints a closing line at the bottom of the specified Dimension. |
static void |
paintClosingLines(java.awt.Graphics g,
java.awt.Dimension d)
Paints two closing lines at the bottom of the specified Dimension. |
static java.lang.String |
removeMnemonicIndicator(java.lang.String text)
Removes the '&' (The mnemonic indicator) from texts that are used for menu entries. |
static void |
requestFocus(java.awt.Component comp)
Requests the focus for the given component. |
static boolean |
runningJDK1_4()
|
static boolean |
saveImageAsBMP(java.awt.image.BufferedImage image,
java.io.File file)
This method will save the given BufferedImageinstance and will
save it to the specified file in 24bitplane uncompressed mode. |
static boolean |
saveImageAsBMP(java.awt.image.BufferedImage image,
java.io.OutputStream os)
This method will save the given BufferedImageinstance and will
save it to the specified output stream in 24bitplane uncompressed mode. |
static boolean |
saveImageAsGIF(java.awt.image.BufferedImage image,
java.io.File file)
Saves the given image in File file using GIF
-encoding. |
static boolean |
saveImageAsJPEG(java.awt.image.BufferedImage image,
java.io.File file,
float quality,
boolean forceBaseline)
Saves the given image in File file using JPEG
-encoding. |
static boolean |
saveImageAsJPEG(java.awt.image.BufferedImage image,
java.io.OutputStream stream,
float quality,
boolean forceBaseline)
Saves the given image in File file using JPEG
-encoding. |
static boolean |
saveImageAsPNG(java.awt.image.RenderedImage image,
java.io.File file)
Saves the given image in File file using GIF
-encoding. |
static boolean |
saveImageAsPNG(java.awt.image.RenderedImage image,
java.io.OutputStream os)
This method basically uses the #saveImagesAs(String, RenderedImage, OutputStream)to save the
given RenderedImage as PNG. |
static void |
setDialogPosition(java.awt.Window dialog,
int horizontalPositionHint,
int verticalPositionHint)
Sets the position of the window according to the position hints |
static void |
setDialogPosition(java.awt.Window dialog,
int horizontalPositionHint,
int verticalPositionHint,
boolean considerMaximumWindowSize)
Sets the position of the window according to the position hints |
static boolean |
setHelpId(java.awt.Component comp,
java.lang.String id)
Dynamically load class javax.help.CSH and invokes method
setHelpId to set a help id to be used for context sensitive
help for the given Component. |
static void |
setPopupMenu(javax.swing.MenuElement popup)
|
static void |
setTopLevelFrameSize(java.awt.Frame frame)
Sets the size of the top level frame to some reasonable portion of the screen. |
static boolean |
showConfirmDialog(java.awt.Component parent,
java.lang.String text,
java.lang.String title)
Shows a confirm dialog, return true if the user confirmed. |
static boolean |
showConfirmDialog(java.awt.Component parent,
java.lang.String text,
java.lang.String title,
int messageType)
Shows a confirm dialog, return true if the user confirmed. |
static boolean |
showConfirmDialog(java.awt.Component parent,
java.lang.String text,
java.lang.String title,
UIManager uiManager)
Shows a confirm dialog, return true if the user confirmed. |
static int |
showConfirmDialogWithCancel(java.awt.Component parent,
java.lang.String text,
java.lang.String title)
Shows a confirm dialog, return user decision. |
static int |
showConfirmDialogWithCancel(java.awt.Component parent,
java.lang.String text,
java.lang.String title,
UIManager uiManager)
Shows a confirm dialog, return user decision. |
static int |
showConfirmDialogWithCancel(java.awt.Component parent,
java.lang.String text,
java.lang.String title,
UIManager uiManager,
int messageType)
Shows a confirm dialog, return user decision. |
static void |
showDialog(java.awt.Dialog dialog)
Shows a dialog in the center. |
static void |
showDialog(java.awt.Window dialog)
Shows a dialog in the center. |
static void |
showDialog(java.awt.Window dialog,
int horizontalPositionHint,
int verticalPositionHint)
Shows a dialog at the given position which is specified by the hints. |
static void |
showDialog(java.awt.Window dialog,
int horizontalPositionHint,
int verticalPositionHint,
boolean considerMaximumWindowSize)
Shows a dialog at the given position which is specified by the hints. |
static void |
showError(java.awt.Component parent,
java.lang.String message)
Deprecated. Use other method, because of the hard coded title string! |
static void |
showError(java.awt.Component parent,
java.lang.String message,
java.lang.String title)
Shows a modal error dialog. |
static void |
showFrame(java.awt.Frame frame,
int horizontalPositionHint,
int verticalPositionHint)
Shows a dialog at the given position which is specified by the hints. |
static int |
showYesNo(java.awt.Component parent,
java.lang.String message)
Deprecated. use showConfirmDialog(Component, String, String) |
static int |
showYesNo(java.awt.Component parent,
java.lang.String message,
java.lang.String title)
Deprecated. use showConfirmDialog(Component, String, String) |
static int |
showYesNo(java.awt.Component parent,
java.lang.String message,
java.lang.String title,
int messageType)
Deprecated. use showConfirmDialog(Component, String, String, int) |
static int |
showYesNoCancel(java.awt.Component parent,
java.lang.String message)
Deprecated. use showConfirmDialogWithCancel(Component, String, String) |
static void |
unregisterMenu(javax.swing.JMenu menu,
java.util.HashMap uiMap)
VIP method to unregister a menu from the uimap. |
static void |
unregisterMenu(javax.swing.JPopupMenu menu,
java.util.HashMap uiMap)
VIP method to unregister a menu from the uimap. |
static void |
updateComponentTreeUI(java.awt.Component c)
A simple minded look and feel change: ask each node in the tree to updateUI() -- that is, to initialize its UI property
with the current look and feel.
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.awt.Insets insDefault
public static final char MNEMONIC_INDICATOR
public static final int YES
public static final int NO
public static final int CANCEL
public static final int CLOSED
public static final int HORIZONTAL_POSITIONHINT_LEFT
public static final int HORIZONTAL_POSITIONHINT_CENTER
public static final int HORIZONTAL_POSITIONHINT_RIGHT
public static final int VERTICAL_POSITIONHINT_TOP
public static final int VERTICAL_POSITIONHINT_CENTER
public static final int VERTICAL_POSITIONHINT_BOTTOM
public static final java.lang.String DEFAULT_ICON
public static final java.lang.String TENSEGRITY_ICON
| Method Detail |
public static final int getMouseButton(java.awt.event.MouseEvent event)
MouseEvent
event - the given MouseEvent
MouseInfo.public static final void setTopLevelFrameSize(java.awt.Frame frame)
frame - the Frame which size should be modified.
public static final boolean setHelpId(java.awt.Component comp,
java.lang.String id)
javax.help.CSH and invokes method
setHelpId to set a help id to be used for context sensitive
help for the given Component. If the archive
javahelp.jar is not in the classpath false will
be returned.
comp - the Component to set a context sensitive help id
for.id - the id to set.
false if class java.help.CSH could not
be loaded.
public static final void showError(java.awt.Component parent,
java.lang.String message)
parent - the parent component.message - the message string to display in the dialog.showError(Component, String, String)
public static final void showError(java.awt.Component parent,
java.lang.String message,
java.lang.String title)
parent - the parent component for this message box.message - the message string to display in the dialog.title - The title string to display in the dialog.
public static int showYesNoCancel(java.awt.Component parent,
java.lang.String message)
showConfirmDialogWithCancel(Component, String, String)
showYesNoCancel shows a messagebox with a
Yes/No/Cancel button bar.
parent - the parent component for this message box.message - the message as String
public static int showYesNo(java.awt.Component parent,
java.lang.String message)
showConfirmDialog(Component, String, String)
showYesN shows a MessageBox with a Yes/No button
bar.
parent - the parent component for this message box.message - the message as String
public static int showYesNo(java.awt.Component parent,
java.lang.String message,
java.lang.String title)
showConfirmDialog(Component, String, String)
showYesN shows a MessageBox with a Yes/No button
bar.
parent - the parent component for this message box.message - the message as String.title - the title for the MessageBox.
public static int showYesNo(java.awt.Component parent,
java.lang.String message,
java.lang.String title,
int messageType)
showConfirmDialog(Component, String, String, int)
showYesN shows a MessageBox with a Yes/No button
bar. This method allows you to change the icon, which is displayed on the
MessageBox.
parent - the parent component for this message box.message - the message as String.title - the title for the MessageBox.messageType - one of the following constants
JOptionPane.ERROR_MESSAGE,
JOptionPane.QUESTION_MESSAGE,
JOptionPane.INFORMATION_MESSAGE,
JOptionPane.WARNING_MESSAGE.
public static final javax.swing.JMenuItem makeMenuItem(UIManager uiManager,
java.lang.String title,
java.lang.String actionCommand,
Command command)
uiManager - the UIManager instance to obtain localized strings from.title - the text of the MenuItem.actionCommand - the action command string.command - the command associated with the MenuItem.
public static final javax.swing.JMenuItem makeMenuItem(UIManager uiManager,
java.lang.String title,
java.lang.String actionCommand,
Command command,
javax.swing.KeyStroke accelerator)
uiManager - the UIManager instance to obtain localized strings from.title - the text of the MenuItem.actionCommand - the action command string.command - the command associated with the MenuItem.accelerator - the accelerator keystroke description.
public static final javax.swing.JRadioButtonMenuItem makeRadioButtonMenuItem(javax.swing.ButtonGroup buttongroup,
java.lang.String title,
javax.swing.Action action)
title - the radioitem text.
public static final javax.swing.JCheckBoxMenuItem makeCheckBoxMenuItem(java.lang.String title,
java.awt.event.ItemListener listener)
title - the radioitem text.listener - the item listener of the checkbox
public static final javax.swing.JCheckBoxMenuItem makeCheckBoxMenuItemSelected(java.lang.String title,
java.awt.event.ItemListener listener)
title - the radioitem text.listener - the item listener of the checkbox
public static javax.swing.JCheckBoxMenuItem makeCheckBoxMenuItem(java.lang.String title,
java.lang.String actionCommand,
javax.swing.Action action)
title - the checkbox titleactionCommand - the action command string.action - the action to associate with the checkbox.
public static final javax.swing.JPanel makeTitlePanel(java.lang.String text)
text - the text to display as the title.
public static javax.swing.JPanel createList(java.awt.Component[] comps)
comps - an array of components.
public static javax.swing.JPanel createTable(java.awt.Component[] left,
java.awt.Component[] right)
left - an array of components.right - an array of components.
public static final javax.swing.JPanel makeEmbeddedComponent(java.awt.Component component)
component - the component to embedd.
public static final javax.swing.JPanel makeOkCancelApplyButtonPanel(java.awt.event.ActionListener okaction,
java.awt.event.ActionListener cancelaction,
java.awt.event.ActionListener applyaction,
UIManager uiManager)
okaction - the listener to call if ok is pressed.cancelaction - the listener to call if ok is pressed.applyaction - the listener to call without closing a dialog.uiManager - the UIManager instance to obtain localized strings from.
public static final javax.swing.JPanel makeCloseApplyButtonPanel(java.awt.event.ActionListener applyaction,
java.awt.event.ActionListener closeaction,
UIManager uiManager)
applyaction - the action to apply without closing a dialog.closeaction - the action to apply if ok is pressed.uiManager - the UIManager instance to obtain localized strings from.
public static final javax.swing.JPanel makeImportExportButtonPanel(java.awt.event.ActionListener importaction,
java.awt.event.ActionListener Exportaction,
UIManager uiManager)
importaction - the action to apply without closing a dialog.Exportaction - the action to apply if ok is pressed.uiManager - the UIManager instance to obtain localized strings from.
public static final javax.swing.JPanel makeOkCancelButtonPanel(java.awt.event.ActionListener okaction,
java.awt.event.ActionListener cancelaction,
UIManager uiManager)
okaction - the listener to inform if ok is pressed.cancelaction - the listener to inform if ok is pressed.uiManager - the ui manager for getting the button text (
GUIItem.OK_BUT_IDS,GUIItem.CANCEL_BUT_IDS
).May be null, but than there will be no text
after creation.
public static final javax.swing.JPanel makeCloseButtonPanel(java.awt.event.ActionListener closeaction,
UIManager uiManager)
closeaction - the action to apply if close is pressed.uiManager - the UIManager instance to obtain localized strings from.
public static final void addToGridBagLayout(java.awt.Container container,
java.awt.Component component,
int fill,
int gX,
int gY,
int gW,
int gH,
double wX,
double wY)
Component to the
GridBagLayout of
the given Container.
- Parameters:
container - the container with the grid bag layoutcomponent - the component to addfill - the fill constant for the grid bag layoutgX - the x position in the gridgY - the y position in the gridgW - the number of cells to be spanned in a rowgH - the number of cells to be spanned in a columnwX - the specification of how additionally space is usedwY - the specification of how additionally space is used- See Also:
GridBagLayout,
GridBagConstraints
public static final void addToGridBagLayout(java.awt.Container container,
java.awt.Component component,
int fill,
int gX,
int gY,
int gW,
int gH,
double wX,
double wY,
java.awt.Insets insets)
Component to the
GridBagLayout of
the given Container.
- Parameters:
container - the container with the grid bag layoutcomponent - the component to addfill - the fill constant for the grid bag layoutgX - the x position in the gridgY - the y position in the gridgW - the number of cells to be spanned in a rowgH - the number of cells to be spanned in a columnwX - the specification of how additionally space is usedwY - the specification of how additionally space is usedinsets - The insets for the added component- See Also:
GridBagLayout,
GridBagConstraints
public static final void addToGridBagLayout(java.awt.Container container,
java.awt.Component component,
int fill,
int gX,
int gY,
int gW,
int gH,
double wX,
double wY,
int anchor)
Component to the
GridBagLayout of the given Container.
- Parameters:
container - the container with the grid bag layoutcomponent - the component to addfill - the fill constant for the grid bag layoutgX - the x position in the gridgY - the y position in the gridgW - the number of cells to be spanned in a rowgH - the number of cells to be spanned in a columnwX - the specification of how additionally space is usedwY - the specification of how additionally space is usedanchor - the anchor for the component to add- See Also:
GridBagLayout,
GridBagConstraints
public static final javax.swing.JPanel getLabelPanel(int align)
align - the flowlayout alighment.
public static final javax.swing.JPanel getLabelPanel(int align,
int hgap,
int vgap)
align - the flowlayout alighment.
public static final java.awt.Component findRoot(java.awt.Component component)
component - the component to search from.
public static final java.awt.Component findRoot(java.awt.Component component,
java.lang.Class constraint)
component - the component to search from.constraint - a class constraint that must be met for any non-null
result.
public static java.awt.Component findChild(java.awt.Container cont,
java.lang.Class type)
cont - The container to examinetype - The type of class to look for
public static final java.awt.Rectangle findBounds(java.awt.Component component)
component - the component of which you want to find the coordinates.
public static final java.awt.Point findCenterPointOnScreen(java.awt.Component component)
component - the component of which you want to find the coordinates.
public static javax.swing.Action commandToAction(Command command)
command - the Command you want be converted to a swing action
commandToAction(Command, UIManager)
public static javax.swing.Action commandToAction(Command command,
UIManager uiManager)
command - the command to wrap.uiManager - the UIManager to get the localized string from.
public static javax.swing.JMenuItem makeMenuItem(java.lang.String id,
Command command,
javax.swing.KeyStroke ks,
UIManager uiManager)
id - the id of the textcommand - the command associated with the menuitem.ks - the keystroke to assign to the menuitem.uiManager - the UIManager instance to obtain localized strings from.
JMenuItem.
public static javax.swing.JMenuItem makeMenuItem(java.lang.String id,
Command command,
UIManager uiManager)
id - the id of the textcommand - the command associated with the menuitem.uiManager - the UIManager instance to obtain localized strings from.
JMenuItem.
public static javax.swing.JMenuItem addToMenu(javax.swing.JMenu menu,
java.util.HashMap uiMap,
java.lang.String id,
Command command,
javax.swing.KeyStroke ks,
UIManager uiManager)
menu - the menu to add the new menuitem to.uiMap - the uimap for text lookup.id - the id of the textcommand - the command associated with the menuitem.ks - the keystroke to assign to the menuitem.uiManager - the UIManager to get the localized string from.
JMenuItem.public static java.lang.String removeMnemonicIndicator(java.lang.String text)
text - The text to change
public static int getIndexOfMnemonic(java.lang.String text)
text - The text to look through
public static javax.swing.JMenuItem addToMenu(javax.swing.JMenu menu,
java.util.HashMap uiMap,
java.lang.String id,
Command command,
javax.swing.KeyStroke ks,
java.lang.String iconurl,
java.lang.Class resourceClass,
UIManager uiManager)
menu - the menu to add the new menuitem to.uiMap - the uimap for text lookup.id - the id of the textcommand - the command associated with the menuitem.ks - the keystroke to assign to the menuitem.iconurl - the url for an icon to assign to the menuitem.resourceClass - the class to load the resources from.uiManager - the UIManager to get the localized string from.
public static javax.swing.JMenuItem addToMenu(javax.swing.JMenu menu,
java.util.HashMap uiMap,
java.lang.String id,
Command command,
UIManager uiManager)
menu - the menu to add the new menuitem to.uiMap - the uimap for text lookup.id - the id of the textcommand - the command associated with the menuitem.uiManager - the UIManager to get the localized string from.
JMenuItem.
public static javax.swing.JMenuItem addToMenu(javax.swing.JMenu menu,
java.util.HashMap uiMap,
java.lang.String id,
Command command,
UIManager uiManager,
javax.swing.Icon icon)
menu - the menu to add the new menuitem to.uiMap - the uimap for text lookup.id - the id of the textcommand - the command associated with the menuitem.uiManager - the UIManager to get the localized string from.icon - the icon to show for the menu-item.
JMenuItem.
public static javax.swing.JMenuItem addToMenu(javax.swing.JMenu menu,
java.util.HashMap uiMap,
java.lang.String id,
Command command,
java.lang.String iconurl,
java.lang.Class resourceClass,
UIManager uiManager)
menu - the menu to add the new MenuItem to.uiMap - the uimap for text lookup.id - the id of the textcommand - the command associated with the MenuItem.iconurl - the url for an icon to assign to the MenuItem.resourceClass - a class instance to use for loading.uiManager - the UIManager to use for localized strings.
JMenuItem.
public static javax.swing.JMenuItem addToMenu(javax.swing.JPopupMenu menu,
java.util.HashMap uiMap,
java.lang.String id,
Command command,
javax.swing.KeyStroke ks,
UIManager uiManager)
menu - the menu to add the new MenuItem to.uiMap - the uimap for text lookup.id - the id of the textcommand - the command associated with the MenuItem.ks - the keystroke to assign to the MenuItem.uiManager - the UIManager to use for localized strings.
JMenuItem.
public static javax.swing.JMenuItem addToMenu(javax.swing.JPopupMenu menu,
java.util.HashMap uiMap,
java.lang.String id,
Command command,
javax.swing.KeyStroke ks,
java.lang.String iconurl,
java.lang.Class resourceClass,
UIManager uiManager)
menu - the menu to add the new MenuItem to.uiMap - the uimap for text lookup.id - the id of the textcommand - the command associated with the MenuItem.ks - the keystroke to assign to the MenuItem.iconurl - the url for an icon to assign to the MenuItem.resourceClass - a class instance to use for loading.uiManager - the UIManager to use for localized strings.
JMenuItem.
public static javax.swing.JMenuItem addToMenu(javax.swing.JPopupMenu menu,
java.util.HashMap uiMap,
java.lang.String id,
Command command,
javax.swing.KeyStroke ks,
java.lang.String iconurl,
java.lang.String rollovericonurl,
java.lang.Class resourceClass,
UIManager uiManager)
menu - the menu to add the new MenuItem to.uiMap - the uimap for text lookup.id - the id of the textcommand - the command associated with the MenuItem.ks - the keystroke to assign to the MenuItem.iconurl - the url for an icon to assign to the MenuItem.rollovericonurl - url of the rollover icon.resourceClass - a class instance to use for loading.uiManager - the UIManager to use for localized strings.
JMenuItem.
public static javax.swing.JMenuItem addToMenu(javax.swing.JPopupMenu menu,
java.util.HashMap uiMap,
java.lang.String id,
Command command,
UIManager uiManager)
menu - the menu to add the new MenuItem to.uiMap - the uimap for text lookup. (optional)id - the id of the textcommand - the command associated with the MenuItem.uiManager - the UIManager to use for localized strings.
JMenuItem.
public static javax.swing.JMenuItem addToMenu(javax.swing.JPopupMenu menu,
java.util.HashMap uiMap,
java.lang.String id,
Command command,
java.lang.String iconurl,
java.lang.Class resourceClass,
UIManager uiManager)
menu - the menu to add the new MenuItem to.uiMap - the uimap for text lookup.id - the id of the textcommand - the command associated with the MenuItem.iconurl - the url for an icon to assign to the MenuItem.resourceClass - a class instance to use for loading.uiManager - the UIManager to use for localized strings.
JMenuItem.
public static final java.awt.Image getResourceImage(java.lang.String iconpath,
java.lang.Class resourceclass)
iconpath - the path relative to the class resourceresourceclass - the class to use as base for the iconpath.
Image.
public static final java.awt.Image getResourceImage(java.lang.String iconpath,
java.lang.Class resourceclass,
java.awt.Component component,
boolean trackResource)
iconpath - ToolBarthe path relative to the class resourceresourceclass - the class to use as base for the
iconpath.component - the component that acts as ImageObserver for the
mediatracker.trackResource - if set to true a MediaTracker will be
used to track the loading of the resource.
Image.
public static final Icon getResourceIcon(java.lang.String iconurl,
java.lang.Class resourceclass,
java.awt.Component component,
boolean trackResource)
iconurl - the path relative to the class resourceresourceclass - the resourceclass to use as base for the iconpath.component - the component that acts as imageobserver for the
mediatracker.trackResource - whether to use media-tracking or not.
Icon.
public static javax.swing.AbstractButton addToToolBar(UIManager uiManager,
javax.swing.JToolBar toolbar,
Command command,
java.lang.String iconurl,
java.lang.Class resourceClass)
NAME property of the action is
cleared, so no text is shown in the ToolBar. Instead an Icon is set, to
identify the command. The name of the given command is used as tooltip
for the resulting button.
uiManager - the UIManagerto use.toolbar - the ToolBar reference.command - the command to use.iconurl - the icon to use.resourceClass - the resource reference class.
JToolbar.add
public static javax.swing.AbstractButton addToToolBar(UIManager uiManager,
javax.swing.JToolBar toolbar,
Command command,
Icon icon)
NAME property of the action is
cleared, so no text is shown in the toolbar. Instead an Icon is set, to
identify the command. The name of the given command is used as tooltip
for the resulting button.
uiManager - the UIManagerto use.toolbar - the toolbar reference.command - the command to use.icon - the icon to use.
JToolbar.add
public static javax.swing.AbstractButton addToToolBar(UIManager uiManager,
javax.swing.JToolBar toolbar,
Command command,
java.lang.String iconurl,
java.lang.String deficonurl,
java.lang.Class resourceClass)
NAME property of the action is
cleared, so no text is shown in the toolbar. Instead an Icon is set, to
identify the command. The name of the given command is used as tooltip
for the resulting button.
uiManager - the UIManagerto use.toolbar - the toolbar reference.command - the command to use.iconurl - the icon to use.deficonurl - the icon to use in windows look and feel.resourceClass - the resource reference class.
JToolbar.addpublic static boolean isTensegrityLookAndFeel()
public static javax.swing.JToggleButton addToToolBarToggleButton(UIManager uiManager,
javax.swing.JToolBar toolbar,
Command command,
java.lang.String iconurl,
java.lang.Class resourceClass)
uiManager - the UIManagerto use.toolbar - the toolbar reference.command - the command to use.resourceClass - class use to load the images.
addToToolBarToggleButton(UIManager, JToolBar, Command, String,
String, Class, int)
public static javax.swing.JToggleButton addToToolBarToggleButton(UIManager uiManager,
javax.swing.JToolBar toolbar,
Command command,
java.lang.String iconurl,
java.lang.String iconurlToggled,
java.lang.Class resourceClass)
uiManager - the UIManagerto use.toolbar - the toolbar reference.command - the command to use.iconurlToggled - icon to use when toggled.resourceClass - class use to load the images.
addToToolBarToggleButton(UIManager, JToolBar, Command, String,
String, Class, int)
public static javax.swing.JToggleButton addToToolBarToggleButton(UIManager uiManager,
javax.swing.JToolBar toolbar,
Command command,
java.lang.String iconurl,
java.lang.String iconurlToggled,
java.lang.Class resourceClass,
int index)
-1 will append the item to
the end of the existing components.
The clue is, that the NAME property of the action is
cleared, so no text is shown in the toolbar. Instead an Icon is set, to
identify the command. The name of the given command is used as tooltip
for the resulting button.
uiManager - required UIManager instance to obtain
localized strings.toolbar - target Toolbar instance to add to.command - the command to be executed when user selects the resulting
button.iconurl - url to the icon, used as image for the button.iconurlToggled - url to the icon, used as image when toggled.resourceClass - class instance to load the icons with.index - the index to insert the element to. Pass -1
to append the item to the end of the toolbar compoents.
public static javax.swing.JToggleButton addToToolBarToggleButton(UIManager uiManager,
javax.swing.JToolBar toolbar,
Command command,
Icon icon,
Icon iconToggled,
int index)
-1 will append the item to
the end of the existing components.
The clue is, that the NAME property of the action is
cleared, so no text is shown in the toolbar. Instead an Icon is set, to
identify the command. The name of the given command is used as tooltip
for the resulting button.
uiManager - required UIManager instance to obtain
localized strings.toolbar - target Toolbar instance to add to.command - the command to be executed when user selects the resulting
button.icon - used as image for the button.iconToggled - url to the icon, used as image when toggled.index - the index to insert the element to. Pass -1
to append the item to the end of the toolbar compoents.
public static javax.swing.JToggleButton createToggleButton(javax.swing.AbstractAction action,
ToggleCommand command)
action - The action for the commandcommand - The toggle command for this toggle button
public static void unregisterMenu(javax.swing.JPopupMenu menu,
java.util.HashMap uiMap)
menu - the menu to remove from the uimapuiMap - the target uiMap to clean up.
public static void unregisterMenu(javax.swing.JMenu menu,
java.util.HashMap uiMap)
menu - the menu to remove from the uimapuiMap - the target uiMap to clean up.
public static void addComponent(java.awt.Container container,
java.awt.Component component,
int fill,
int gX,
int gY,
int gW,
int gH,
double wX,
double wY)
container - the container to add tocomponent - the component to add tofill - gridbad constraintgX - gridbad constraintgY - gridbad constraintgW - gridbad constraintgH - gridbad constraintwX - gridbad constraintwY - gridbad constraint
public static void addComponent(java.awt.Container container,
java.awt.Component component,
int fill,
int gX,
int gY,
int gW,
int gH,
double wX,
double wY,
java.awt.Insets insets)
container - the container to add tocomponent - the component to add tofill - gridbad constraintgX - gridbad constraintgY - gridbad constraintgW - gridbad constraintgH - gridbad constraintwX - gridbad constraintwY - gridbad constraintinsets - the insets
public static final javax.swing.border.Border createTitleFrameBorder(java.lang.String title,
int top,
int left,
int bottom,
int right)
title - Title as string of your border.top - space in pixels you want to have top.left - space in pixels you want to have left.bottom - space in pixels you want to have bottom.right - space in pixels you want to have right.
public static final void dumpComponentTree(java.awt.Component component)
component - the root of the component tree to dump.public static void showDialog(java.awt.Window dialog)
dialog - the dialog to show.public static void showDialog(java.awt.Dialog dialog)
dialog - the dialog to show.
public static final void showDialog(java.awt.Window dialog,
int horizontalPositionHint,
int verticalPositionHint)
dialog - the dialog to show.horizontalPositionHint - one of the positionhints defined in this
class.verticalPositionHint - one of the positionhints defined in this
class.
public static final void showDialog(java.awt.Window dialog,
int horizontalPositionHint,
int verticalPositionHint,
boolean considerMaximumWindowSize)
dialog - the dialog to show.horizontalPositionHint - one of the positionhints defined in this
class.verticalPositionHint - one of the positionhints defined in this
class.considerMaximumWindowSize - if true, the window will be
positioned in the available space
instead of the complete screen size
public static void setDialogPosition(java.awt.Window dialog,
int horizontalPositionHint,
int verticalPositionHint)
dialog - the dialog to show.horizontalPositionHint - one of the positionhints defined in this
class.verticalPositionHint - one of the positionhints defined in this
class.
public static void setDialogPosition(java.awt.Window dialog,
int horizontalPositionHint,
int verticalPositionHint,
boolean considerMaximumWindowSize)
dialog - the dialog to show.horizontalPositionHint - one of the positionhints defined in this
class.verticalPositionHint - one of the positionhints defined in this
class.considerMaximumWindowSize - if true, the window will be
positioned in the available space
instead of the complete screen size
public static final void showFrame(java.awt.Frame frame,
int horizontalPositionHint,
int verticalPositionHint)
horizontalPositionHint - one of the positionhints defined in this
class.verticalPositionHint - one of the positionhints defined in this
class.
public static final boolean showConfirmDialog(java.awt.Component parent,
java.lang.String text,
java.lang.String title,
UIManager uiManager)
parent - the parent of the component.text - the text to display.title - the title string of the dialog window.uiManager - The uiManager to resolve text resources (buttons)
public static final boolean showConfirmDialog(java.awt.Component parent,
java.lang.String text,
java.lang.String title)
parent - the parent of the component.text - the text to display.title - the title string of the dialog window.
public static final boolean showConfirmDialog(java.awt.Component parent,
java.lang.String text,
java.lang.String title,
int messageType)
parent - the parent of the component.text - the text to display.title - the title string of the dialog window.messageType - the message type of the confirmation dialog
public static final int showConfirmDialogWithCancel(java.awt.Component parent,
java.lang.String text,
java.lang.String title,
UIManager uiManager)
parent - the parent of the component.text - the text to display.title - the title string of the dialog window.uiManager - The uiManager to resolve text resources (buttons)
public static final int showConfirmDialogWithCancel(java.awt.Component parent,
java.lang.String text,
java.lang.String title,
UIManager uiManager,
int messageType)
parent - the parent of the component.text - the text to display.title - the title string of the dialog window.uiManager - The uiManager to resolve text resources (buttons)messageType - the message type of the confirmation dialog
public static final int showConfirmDialogWithCancel(java.awt.Component parent,
java.lang.String text,
java.lang.String title)
parent - the parent of the component.text - the text to display.title - the title string of the dialog window.
public static final boolean saveImageAsBMP(java.awt.image.BufferedImage image,
java.io.File file)
throws java.lang.Exception
BufferedImageinstance and will
save it to the specified file in 24bitplane uncompressed mode.
image - the image to save.file - the file where to save.
exception - arbitrary exception if something goes wrong during
saving.
java.lang.Exception
public static final boolean saveImageAsBMP(java.awt.image.BufferedImage image,
java.io.OutputStream os)
throws java.lang.Exception
BufferedImageinstance and will
save it to the specified output stream in 24bitplane uncompressed mode.
image - the image to save.os - the output where to save.
java.lang.Exception - arbitrary exception if something goes wrong during
saving.
public static boolean saveImageAsJPEG(java.awt.image.BufferedImage image,
java.io.File file,
float quality,
boolean forceBaseline)
File file using JPEG
-encoding.
image - the image to save.file - the file in which to save.quality - a value between 0.0 (low quality) and 1.0 (high quality)forceBaseline - force baseline quantization table
true, if saving was successful.
public static boolean saveImageAsJPEG(java.awt.image.BufferedImage image,
java.io.OutputStream stream,
float quality,
boolean forceBaseline)
File file using JPEG
-encoding.
image - the image to save.stream - the stream to save to.quality - a value between 0.0 (low quality) and 1.0 (high quality)forceBaseline - force baseline quantization table
true, if saving was successful.
public static boolean saveImageAsGIF(java.awt.image.BufferedImage image,
java.io.File file)
File file using GIF
-encoding.
image - the image to save.file - the file in which to save.
true, if saving was successful.
public static boolean saveImageAsPNG(java.awt.image.RenderedImage image,
java.io.File file)
File file using GIF
-encoding.
image - the image to save.file - the location to save the image to.
true, if saving was successful.
public static boolean saveImageAsPNG(java.awt.image.RenderedImage image,
java.io.OutputStream os)
#saveImagesAs(String, RenderedImage, OutputStream)to save the
given RenderedImage as PNG.
image - the RenderedImage instance to save.os - the Stream to write the png to.
public static boolean canWriteFormat(java.lang.String formatName)
true if the specified format name can be written
formatName - the name of the format, for example gif.
true iff the format can be written.public static boolean runningJDK1_4()
public static final void paintClosingLine(java.awt.Graphics g,
java.awt.Dimension d)
Dimension.
g - Graphicsto paint into.d - the dimensions of the painting area.
public static final void paintClosingLines(java.awt.Graphics g,
java.awt.Dimension d)
Dimension.
g - Graphicsto paint into.d - the dimensions of the painting area.public static void alignMenuItems(javax.swing.JComponent menu)
MenuElements of the given Menu
Component evenly according to a "normal" MenuItem with an Icon. MenuItems
without an icon, will get a proper border to align them to the
icon-items. Same goes out for Check- and RadioMenuItems. If the current
element in the loop is again a Menu or SwingPopupMenu, this method will
recurse.
menu - a JComponent of type MenuElement.public static void setPopupMenu(javax.swing.MenuElement popup)
public static javax.swing.MenuElement getPopupMenu()
public static java.awt.Rectangle getMaximumWindowBounds()
public static void requestFocus(java.awt.Component comp)
comp - The component to request focus forpublic static java.awt.Color getUIColor(java.lang.Object key)
defaultColor if the entry does not exist.
Should be used instead of UIManager.getColor(), because some
look and feels might not support all entries.
The defaultcolor is taken from a map of defaults that equal the
entries of the windows look and feel in JRE 1.5.
If the key is not part of the defaults, white is returned.
key - The key of the color to retrieve
defaultColor
if the entry does not exist.
public static java.awt.Color getUIColor(java.lang.Object key,
java.awt.Color defaultColor)
defaultColor if the entry does not exist.
Should be used instead of UIManager.getColor(), because some
look and feels might not support all entries.
key - The key of the color to retrievedefaultColor - The default color to use if the entry does
not exist
defaultColor
if the entry does not exist.
public static void drawString(javax.swing.JComponent comp,
java.awt.Graphics2D g2d,
java.lang.String str)
comp - The component the graphics belongs tog2d - The graphics to draw intostr - The string to draw
public static void drawString(javax.swing.JComponent comp,
java.awt.Graphics2D g2d,
java.lang.String str,
java.awt.Insets additionalInsets)
comp - The component the graphics belongs tog2d - The graphics to draw intostr - The string to drawadditionalInsets - Use this to reduce the available space and
offset the textpublic static void updateComponentTreeUI(java.awt.Component c)
updateUI() -- that is, to initialize its UI property
with the current look and feel.
This is a copy of the SwingUtilities.updateComponentTreeUI(java.awt.Component)
method including a fix for JToolBars, so that children are processed
before the parent.
c - The root of the component tree
public static final void doWhenVisible(java.awt.Component component,
java.lang.Runnable runnable)
Runnable when the given component got a valid size.
component - The component to listen torunnable - The runnable to startpublic static void busyStart(java.awt.Component busyComponent)
busyComponent - The component to set the cursor topublic static void busyEnd(java.awt.Component busyComponent)
busyComponent - The component to set the cursor to
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||