public class GUIUtilities extends Object
Modifier and Type | Field and Description |
---|---|
static String |
ACCELERATOR_KEY
JDK1.2 doesn't have this string defined in javax.swing.Action.
|
static String |
LARGE_ICON
This key is used in an action to specify an icon used in toolbars.
|
static String |
MNEMONIC_KEY
JDK1.2 doesn't have this string defined in javax.swing.Action.
|
Constructor and Description |
---|
GUIUtilities() |
Modifier and Type | Method and Description |
---|---|
static void |
addHotKey(JComponent pane,
Action action)
Add a quick keystroke on the given pane for the given action.
|
static void |
addHotKey(JComponent pane,
Action action,
KeyStroke key)
Add a quick keystroke on the given pane for the given action.
|
static JMenuItem |
addMenuItem(JMenu menu,
Action action)
Add an action to a menu and return the menu item created.
|
static JMenuItem |
addMenuItem(JMenu menu,
Action action,
int mnemonic,
String tooltip)
Add an action to a menu and return the menu item created.
|
static JMenuItem |
addMenuItem(JMenu menu,
String label,
Action action,
int mnemonic,
String tooltip,
boolean isEnabled)
Add an action to a menu and return the menu item created.
|
static JButton |
addToolBarButton(JToolBar toolbar,
Action action)
Add the action to the given toolbar.
|
static JButton |
addToolBarButton(JToolBar toolbar,
Action action,
String tooltip,
Icon icon)
Add an action to the toolbar.
|
static JButton |
addToolBarButton(JToolBar toolbar,
Action action,
String tooltip,
Icon icon,
boolean isEnabled)
Add an action to the toolbar.
|
static JButton |
addToolBarButton(JToolBar toolbar,
Action action,
String tooltip,
Icon icon,
String lbl)
Add an action to the toolbar.
|
static JButton |
addToolBarButton(JToolBar toolbar,
Action action,
String tooltip,
Icon icon,
String lbl,
boolean isEnabled)
Add an action to the toolbar.
|
static JButton |
addToolBarButton(JToolBar toolbar,
Action action,
String tooltip,
String lbl)
Add an action to the toolbar.
|
static String |
ellipsis(String string,
int length)
Return a string that contains the original string, limited to the
given number of characters.
|
static String |
getFileExtension(File file)
Get the extension of a file.
|
static String |
keyStrokeToString(KeyStroke key)
Return a good string representation of the given keystroke, since
the toString method returns more garbage than we want to see in a
user interface.
|
static void |
showException(Component parent,
Exception e,
String info)
Display an exception in a nice user-oriented way.
|
static void |
showStackTrace(Component parent,
Exception e)
Display a stack trace dialog.
|
static void |
showStackTrace(Component parent,
Exception e,
String info)
Display a stack trace dialog.
|
public static final String ACCELERATOR_KEY
public static final String MNEMONIC_KEY
public static final String LARGE_ICON
public static void addHotKey(JComponent pane, Action action)
public static void addHotKey(JComponent pane, Action action, KeyStroke key)
public static JMenuItem addMenuItem(JMenu menu, Action action)
public static JMenuItem addMenuItem(JMenu menu, Action action, int mnemonic, String tooltip)
public static JMenuItem addMenuItem(JMenu menu, String label, Action action, int mnemonic, String tooltip, boolean isEnabled)
public static JButton addToolBarButton(JToolBar toolbar, Action action)
public static JButton addToolBarButton(JToolBar toolbar, Action action, String tooltip, Icon icon)
public static JButton addToolBarButton(JToolBar toolbar, Action action, String tooltip, Icon icon, boolean isEnabled)
public static JButton addToolBarButton(JToolBar toolbar, Action action, String tooltip, String lbl)
public static JButton addToolBarButton(JToolBar toolbar, Action action, String tooltip, Icon icon, String lbl)
public static JButton addToolBarButton(JToolBar toolbar, Action action, String tooltip, Icon icon, String lbl, boolean isEnabled)
public static String ellipsis(String string, int length)
public static String getFileExtension(File file)
public static String keyStrokeToString(KeyStroke key)
public static void showException(Component parent, Exception e, String info)
public static void showStackTrace(Component parent, Exception e)
Copyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.