public final class SwingUtil extends Object
Modifier and Type | Field and Description |
---|---|
protected static JFileChooser |
chooser |
Modifier and Type | Method and Description |
---|---|
static void |
centerWindow(Rectangle bounds,
Window window)
Centers the given window within the specified bounds.
|
static void |
centerWindow(Window window)
Centers the given window on the screen.
|
static void |
centerWindow(Window parent,
Window window)
Centers the given window within the specified parent window.
|
static JMenuBar |
cloneMenuBar(JMenuBar menubar)
Creates a copy of this menu bar, whose contents update automatically
whenever the original menu bar changes.
|
static JMenuItem |
cloneMenuItem(JMenuItem item)
Creates a copy of this menu item, whose contents update automatically
whenever the original menu item changes.
|
static void |
configureScrollPane(JScrollPane scroll)
Configures a scroll pane's properties to always show horizontal and
vertical scroll bars.
|
static void |
expandTree(JTree tree,
DefaultMutableTreeNode node)
Fully expands the given JTree from the specified node.
|
static Dimension |
getRepackSize(Window w)
Gets the dimension of this window were it to be repacked.
|
static JFileChooser |
getVisBioFileChooser()
Constructs a JFileChooser that recognizes accepted VisBio file types.
|
static Window |
getWindow(Component c)
Gets the containing window for the given component.
|
static String |
getWindowTitle(Window w)
Gets the title of the given window.
|
protected static void |
linkMenuItem(JMenuItem master,
JMenuItem slave)
Forces slave menu item to reflect master menu item using a property change
listener.
|
static JButton |
makeButton(Object owner,
String id,
String altText,
int wpad,
int hpad)
Constructs a JButton with an icon from the given file id.
|
static JToggleButton |
makeToggleButton(Object owner,
String id,
String altText,
int wpad,
int hpad)
Constructs a JToggleButton with an icon from the given file id.
|
static void |
pack(Window w)
Packs a window, with hacks to correct for inaccuracies in certain cases.
|
static void |
pause(String msg)
Pops up a message box, blocking the current thread.
|
static void |
pause(Throwable t)
Pops up a message box, blocking the current thread.
|
static void |
repack(Window w)
Enlarges a window to its preferred width and/or height if it is too small.
|
static void |
setCursor(Component c,
Cursor cursor)
Sets the cursor for the given component and all child components to the
given cursor.
|
static void |
setWaitCursor(Component c,
boolean wait)
Toggles the cursor for the given component and all child components between
the wait cursor and the normal one.
|
static void |
setWindowTitle(Window w,
String title)
Sets the title of the given window.
|
protected static void |
syncMenuItem(JMenuItem source,
JMenuItem dest)
Brings the destination menu item into sync with the source item.
|
protected static JFileChooser chooser
public static JButton makeButton(Object owner, String id, String altText, int wpad, int hpad)
public static JToggleButton makeToggleButton(Object owner, String id, String altText, int wpad, int hpad)
public static void expandTree(JTree tree, DefaultMutableTreeNode node)
public static void setWaitCursor(Component c, boolean wait)
public static void setCursor(Component c, Cursor cursor)
public static Window getWindow(Component c)
public static void pack(Window w)
public static void repack(Window w)
public static Dimension getRepackSize(Window w)
public static void centerWindow(Window window)
public static void centerWindow(Window parent, Window window)
public static void centerWindow(Rectangle bounds, Window window)
public static void setWindowTitle(Window w, String title)
public static JMenuBar cloneMenuBar(JMenuBar menubar)
public static JMenuItem cloneMenuItem(JMenuItem item)
public static void configureScrollPane(JScrollPane scroll)
public static JFileChooser getVisBioFileChooser()
public static void pause(String msg)
public static void pause(Throwable t)
protected static void linkMenuItem(JMenuItem master, JMenuItem slave)
Copyright © 2015–2022 SciJava. All rights reserved.