public class GUIUtilities
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.util.Hashtable |
menuItemsActions
Contains the action name and label of each menu item
|
Constructor and Description |
---|
GUIUtilities() |
Modifier and Type | Method and Description |
---|---|
static void |
error(java.awt.Frame frame,
java.lang.String name,
java.lang.Object[] args)
Displays an error dialog box.
|
static java.lang.String |
getColorHexString(java.awt.Color c)
Converts a color object to its hex value.
|
static java.awt.Image |
getJextIconImage()
Returns the Jext environment icon.
|
static java.lang.String |
getStyleString(SyntaxStyle style)
Converts a style into it's string representation.
|
static void |
loadGeometry(java.awt.Window win,
java.lang.String name)
Load a window geometry from a propery file and apply it to
the specified window.
|
static javax.swing.JMenu |
loadMenu(java.lang.String name) |
static javax.swing.JMenu |
loadMenu(java.lang.String name,
boolean isLabel)
Loads a menu from the properties.
|
static javax.swing.JMenuItem |
loadMenuItem(java.lang.String action)
This method creates a new JMenuItem.
|
static javax.swing.JMenuItem |
loadMenuItem(java.lang.String label,
java.lang.String action,
java.lang.String picture,
boolean enabled)
This method creates a new JMenuItem.
|
static javax.swing.JMenuItem |
loadMenuItem(java.lang.String label,
java.lang.String action,
java.lang.String picture,
boolean enabled,
boolean list)
This method creates a new JMenuItem.
|
static void |
message(java.awt.Frame frame,
java.lang.String name,
java.lang.Object[] args)
Displays a dialog box.
|
static java.awt.Color |
parseColor(java.lang.String name)
Converts a hex color value prefixed with #, for example #ff0088.
|
static SyntaxStyle |
parseStyle(java.lang.String str)
Converts a style string to a style object.
|
static void |
requestFocus(java.awt.Window win,
java.awt.Component comp)
Focuses on the specified component as soon as the window becomes
active.
|
static void |
saveGeometry(java.awt.Window win,
java.lang.String name)
Saves a window geometry
|
static void |
setScrollableTabbedPane(javax.swing.JTabbedPane pane)
Sets the scrollable behavior of a JTabbedPane.
|
public static java.util.Hashtable menuItemsActions
public static final java.awt.Image getJextIconImage()
public static void setScrollableTabbedPane(javax.swing.JTabbedPane pane)
public static void requestFocus(java.awt.Window win, java.awt.Component comp)
win
- The windowcomp
- The componentpublic static void saveGeometry(java.awt.Window win, java.lang.String name)
win
- The Window
name
- Name of the properties containing the geometrypublic static void loadGeometry(java.awt.Window win, java.lang.String name)
win
- The Window
name
- Name of the properties containing the geometrypublic static void message(java.awt.Frame frame, java.lang.String name, java.lang.Object[] args)
name.title
property. The message is fetched
from the name.message
property. The message
is formatted by the property manager with args
as
positional parameters.frame
- The frame to display the dialog forname
- The name of the dialogargs
- Positional parameters to be substituted into the
message textpublic static void error(java.awt.Frame frame, java.lang.String name, java.lang.Object[] args)
name.title
property. The message is fetched
from the name.message
property. The message
is formatted by the property manager with args
as
positional parameters.frame
- The frame to display the dialog forname
- The name of the dialogargs
- Positional parameters to be substituted into the
message textpublic static java.awt.Color parseColor(java.lang.String name)
name
- The color valuepublic static java.lang.String getColorHexString(java.awt.Color c)
c
- The color objectpublic static SyntaxStyle parseStyle(java.lang.String str) throws java.lang.IllegalArgumentException
str
- The style stringjava.lang.IllegalArgumentException
- if the style is invalidpublic static java.lang.String getStyleString(SyntaxStyle style)
style
- The stylepublic static javax.swing.JMenu loadMenu(java.lang.String name)
public static javax.swing.JMenu loadMenu(java.lang.String name, boolean isLabel)
name
. The menu label is
obtained from the name.label
property.name
- The menu nameisLabel
- True if name is label, toopublic static javax.swing.JMenuItem loadMenuItem(java.lang.String action)
action
- Plugin action nameJMenuItem
public static javax.swing.JMenuItem loadMenuItem(java.lang.String label, java.lang.String action, java.lang.String picture, boolean enabled)
label
- The menu item labelaction
- The name of the action, specified in JextkeyStroke
- The keystroke used as acceleratorpicture
- Relative path to an iconenabled
- Disable the item if falseJMenuItem
public static javax.swing.JMenuItem loadMenuItem(java.lang.String label, java.lang.String action, java.lang.String picture, boolean enabled, boolean list)
label
- The menu item labelaction
- The name of the action, specified in JextkeyStroke
- The keystroke used as acceleratorpicture
- Relative path to an iconenabled
- Disable the item if falselist
- If true adds item info to a listJMenuItem
Copyright ? 2002 Romain Guy.