public class GuiUtil
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
GuiUtil.ProgressRunnable
Runnable for running protected by modal progress dialog.
|
Modifier and Type | Field and Description |
---|---|
static int |
PAD
Constant used for padding in dialogs.
|
static int |
SMALL_PAD
Constant used for small padding in dialogs.
|
Constructor and Description |
---|
GuiUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
addStyle(javax.swing.JTextPane textPane,
java.lang.String name,
java.awt.Color foreground) |
static void |
addStyle(javax.swing.JTextPane pane,
java.lang.String name,
java.awt.Color foreground,
java.awt.Color background) |
static void |
addStyle(javax.swing.JTextPane textPane,
java.lang.String name,
java.awt.Color foreground,
java.awt.Color background,
boolean bold) |
static void |
copyToClipboard(java.lang.String text) |
static java.lang.Object |
createComboBoxItem(java.lang.String item)
Wrapper object for JComboBox items.
|
static javax.swing.border.Border |
createEmptyBorder()
Create empty border with normal padding.
|
static javax.swing.Box.Filler |
createFiller()
Create empty box with size of normal padding.
|
static javax.swing.border.Border |
createSmallEmptyBorder()
Create empty border with small padding.
|
static javax.swing.Box.Filler |
createSmallFiller()
Create empty box with size of small padding.
|
static java.lang.String |
getClipboardText() |
static int |
getDefaultMonoFontSize()
Get size of default monspaced font.
|
static javax.swing.ImageIcon |
getIcon(java.lang.String icon,
java.lang.String name) |
static java.lang.String |
getMessageCss()
Return a style sheet for message labels using HTML.
|
static void |
initLookAndFeel(java.lang.String laf)
Init look and feel.
|
static java.lang.String |
insertLineBreaks(java.lang.String message)
Manually break message into multiple lines for multi-line labels.
|
static void |
invokeAndWait(java.lang.Runnable runnable)
Call SwingUtilities.invokeAndWait.
|
static boolean |
isActiveWindow(java.awt.Window window) |
static boolean |
isNormalSizeMode(javax.swing.JFrame window)
Check window for normal state.
|
static void |
paintImmediately(javax.swing.JComponent component) |
static void |
removeKeyBinding(javax.swing.JComponent component,
java.lang.String key) |
static void |
runProgress(java.awt.Frame owner,
java.lang.String message,
GuiUtil.ProgressRunnable runnable)
Run in separate thread protected by a modal progress dialog.
|
static void |
setAntiAlias(java.awt.Graphics graphics)
Set antialias rendering hint if graphics is instance of Graphics2D.
|
static void |
setEditableFalse(javax.swing.JTextField field)
Set text field non-editable.
|
static void |
setGoIcon(java.awt.Frame frame)
Set Go icon on frame.
|
static void |
setMacBevelButton(javax.swing.JButton button)
Set property to render button in bevel style on the Mac.
|
static void |
setMonospacedFont(javax.swing.JComponent component) |
static void |
setStyle(javax.swing.JTextPane textPane,
int start,
int length,
java.lang.String name) |
static void |
setTextAndMnemonic(javax.swing.AbstractButton button,
java.lang.String text)
Parse text that has the mnemonic marked with a preceding'&'
(like in Qt) and set the text and mnemonic of the button.
|
static void |
setUnlimitedSize(javax.swing.JComponent component) |
public static final int PAD
public static final int SMALL_PAD
public static void addStyle(javax.swing.JTextPane pane, java.lang.String name, java.awt.Color foreground, java.awt.Color background)
public static void copyToClipboard(java.lang.String text)
public static java.lang.Object createComboBoxItem(java.lang.String item)
public static javax.swing.border.Border createEmptyBorder()
PAD
public static javax.swing.Box.Filler createFiller()
PAD
public static javax.swing.border.Border createSmallEmptyBorder()
SMALL_PAD
public static javax.swing.Box.Filler createSmallFiller()
SMALL_PAD
public static java.lang.String getClipboardText()
public static java.lang.String getMessageCss()
public static int getDefaultMonoFontSize()
public static javax.swing.ImageIcon getIcon(java.lang.String icon, java.lang.String name)
public static void initLookAndFeel(java.lang.String laf)
public static java.lang.String insertLineBreaks(java.lang.String message)
public static void invokeAndWait(java.lang.Runnable runnable)
public static boolean isActiveWindow(java.awt.Window window)
public static boolean isNormalSizeMode(javax.swing.JFrame window)
public static void paintImmediately(javax.swing.JComponent component)
public static void removeKeyBinding(javax.swing.JComponent component, java.lang.String key)
public static void runProgress(java.awt.Frame owner, java.lang.String message, GuiUtil.ProgressRunnable runnable) throws java.lang.Throwable
owner
- Parent for the progress dialog.message
- Title for the progress dialog.runnable
- Runnable to run.java.lang.Throwable
- Any exception that ProgressRunnable.run throwed,
you have to use instanceof to check for specific exception classes.public static void setAntiAlias(java.awt.Graphics graphics)
public static void setEditableFalse(javax.swing.JTextField field)
public static void setGoIcon(java.awt.Frame frame)
public static void setTextAndMnemonic(javax.swing.AbstractButton button, java.lang.String text)
public static void setMacBevelButton(javax.swing.JButton button)
public static void setMonospacedFont(javax.swing.JComponent component)
public static void addStyle(javax.swing.JTextPane textPane, java.lang.String name, java.awt.Color foreground)
public static void addStyle(javax.swing.JTextPane textPane, java.lang.String name, java.awt.Color foreground, java.awt.Color background, boolean bold)
public static void setStyle(javax.swing.JTextPane textPane, int start, int length, java.lang.String name)
public static void setUnlimitedSize(javax.swing.JComponent component)