| Modifier | Constructor and Description |
|---|---|
private |
GuiHelper() |
| Modifier and Type | Method and Description |
|---|---|
static JScrollPane |
embedInVerticalScrollPane(Component panel)
Embeds the given component into a new vertical-only scrollable
JScrollPane. |
static void |
executeByMainWorkerInEDT(Runnable task) |
static Stroke |
getCustomizedStroke(String code)
Return s new BasicStroke object with given thickness and style
|
static ImageIcon |
getDisabledIcon(ImageIcon icon)
Replies the disabled (grayed) version of the specified icon.
|
static Image |
getDisabledImage(Image image)
Replies the disabled (grayed) version of the specified image.
|
static int |
getMenuShortcutKeyMaskEx()
Returns extended modifier key used as the appropriate accelerator key for menu shortcuts.
|
static Font |
getMonospacedFont(JComponent component)
Gets the font used to display monospaced text in a component, if possible.
|
static Font |
getTitleFont()
Gets the font used to display JOSM title in about dialog and splash screen.
|
static void |
notifyUserHtmlError(Component parent,
String title,
String message,
String html)
Notifies user about an error received from an external source as an HTML page.
|
static Component |
prepareResizeableOptionPane(Component pane,
Dimension minDimension)
Attaches a
HierarchyListener to the specified Component that
will set its parent dialog resizeable. |
static void |
runInEDT(Runnable task)
Executes asynchronously a runnable in
Event Dispatch Thread.
|
static void |
runInEDTAndWait(Runnable task)
Executes synchronously a runnable in
Event Dispatch Thread.
|
static <V> V |
runInEDTAndWaitAndReturn(Callable<V> callable)
Executes synchronously a callable in
Event Dispatch Thread
and return a value.
|
static Timer |
scheduleTimer(int initialDelay,
ActionListener actionListener,
boolean repeats)
Schedules a new Timer to be run in the future (once or several times).
|
static void |
setBackgroundReadable(JComponent c,
Color background)
Sets the background color for this component, and adjust the foreground color so the text remains readable.
|
static void |
setEnabledRec(Container root,
boolean enabled)
disable / enable a component and all its child components
|
static void |
setUIFont(String name)
Sets a global font for all UI, replacing default font of current look and feel.
|
static boolean |
warnUser(String title,
String content,
ImageIcon baseActionIcon,
String continueToolTip)
Warns user about a dangerous action requiring confirmation.
|
private GuiHelper()
public static void setEnabledRec(Container root, boolean enabled)
root - componentenabled - enabled statepublic static void executeByMainWorkerInEDT(Runnable task)
public static void runInEDT(Runnable task)
task - The runnable to executeSwingUtilities.invokeLater(java.lang.Runnable)public static void runInEDTAndWait(Runnable task)
task - The runnable to executeSwingUtilities.invokeAndWait(java.lang.Runnable)public static <V> V runInEDTAndWaitAndReturn(Callable<V> callable)
V - the result type of method callcallable - The callable to executepublic static boolean warnUser(String title, String content, ImageIcon baseActionIcon, String continueToolTip)
title - Title of dialogcontent - Content of dialogbaseActionIcon - Unused? FIXME why is this parameter unused?continueToolTip - Tooltip to display for "continue" buttonpublic static void notifyUserHtmlError(Component parent, String title, String message, String html)
parent - Parent componenttitle - Title of dialogmessage - Message displayed at the top of the dialoghtml - HTML content to display (real error message)public static Image getDisabledImage(Image image)
image - The image to disablepublic static ImageIcon getDisabledIcon(ImageIcon icon)
icon - The icon to disablepublic static Component prepareResizeableOptionPane(Component pane, Dimension minDimension)
HierarchyListener to the specified Component that
will set its parent dialog resizeable. Use it before a call to JOptionPane#showXXXXDialog
to make it resizeable.pane - The component that will be displayedminDimension - The minimum dimension that will be set for the dialog. Ignored if nullpanepublic static Timer scheduleTimer(int initialDelay, ActionListener actionListener, boolean repeats)
initialDelay - milliseconds for the initial and between-event delay if repeatableactionListener - an initial listener; can be nullrepeats - specify false to make the timer stop after sending its first action eventpublic static Stroke getCustomizedStroke(String code)
code - = 3.5 -> thickness=3.5px; 3.5 10 5 -> thickness=3.5px, dashed: 10px filled + 5px emptypublic static Font getMonospacedFont(JComponent component)
component - The componentpublic static Font getTitleFont()
public static JScrollPane embedInVerticalScrollPane(Component panel)
JScrollPane.panel - The component to embedJScrollPanepublic static int getMenuShortcutKeyMaskEx()
Toolkit.getMenuShortcutKeyMask() to get the cross-platform modifier, but:
public static void setUIFont(String name)
name - Font name. It is up to the caller to make sure the font existsIllegalArgumentException - if name is nullpublic static void setBackgroundReadable(JComponent c, Color background)
c - componentbackground - background color