public class UIUtilities extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
clipboardContainsString()
Test if the system clipboard currently contains a transferrable object which can be
accessed as string.
|
static JPanel |
createFlexiblePanel(Component c,
boolean horizontal)
Creates a panel which will expand to fill all additional space in the enclosing
container, without expanding the contained component.
|
static JMenuItem |
createMenuItem(Action a)
Creates a JMenuItem from an action.
|
static void |
dismantleHierarchy(Container c)
Dismantles a hierarchy of nested components by removing all children from their parents.
|
static Dimension |
fitToScreen(Dimension size,
GraphicsConfiguration screen)
Returns a new size where width and height are the minimum of the given size and the available screen space.
|
static void |
initAction(Action a,
String key,
Object... data)
Initializes an action with values taken from the messages resource
bundle.
|
static AbstractButton |
initButton(AbstractButton b,
String key)
Initializes a button with values taken from the messages resource bundle.
|
static void |
makeVisible(JTextComponent textPane,
int start,
int end)
Scroll a text component inside a viewport such that the text at the specified position
becomes visible.
|
static void |
setCancelAction(RootPaneContainer c,
Action cancelAction)
Set up the escape keyboard shortcut for a
JFrame or JDialog . |
public static void initAction(Action a, String key, Object... data)
a
- The action to initialize.key
- The base key in the messages resource bundle.data
- data to insert as parameters in the name of the action.Action
public static AbstractButton initButton(AbstractButton b, String key)
a
- The action to initialize.key
- The base key in the messages resource bundle.Action
public static JMenuItem createMenuItem(Action a)
propertyChangeListener
to the action. Thus the item can't be garbage collected
while the action object is still alive. If the menu item is no longer used, the action must be
removed through a call of item.setAction( null)
.a
- The action for which to create the menu item.public static JPanel createFlexiblePanel(Component c, boolean horizontal)
public static void dismantleHierarchy(Container c)
public static void setCancelAction(RootPaneContainer c, Action cancelAction)
JFrame
or JDialog
.cancelAction
- Action to be performed when the ESCAPE key is hit. Usually cancels
the dialog.public static boolean clipboardContainsString()
true
if the system clipboard contains a string.public static void makeVisible(JTextComponent textPane, int start, int end)
textPane
- The text pane which is scrolled.start
- Start offset in the document.end
- End offset in the document.public static Dimension fitToScreen(Dimension size, GraphicsConfiguration screen)
size
- The original size of the component on the screen (usually a window).screen
- Configuration of the screen on which the component should be shown.Copyright © 2001-2013 the JGloss developers. All Rights Reserved.