org.jext
Class GUIUtilities

java.lang.Object
  extended byorg.jext.GUIUtilities

public class GUIUtilities
extends java.lang.Object

Contains a bunch of methods used to build the GUI.


Field Summary
static java.util.Hashtable menuItemsActions
          Contains the action name and label of each menu item
 
Constructor Summary
GUIUtilities()
           
 
Method Summary
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

menuItemsActions

public static java.util.Hashtable menuItemsActions
Contains the action name and label of each menu item

Constructor Detail

GUIUtilities

public GUIUtilities()
Method Detail

getJextIconImage

public static final java.awt.Image getJextIconImage()
Returns the Jext environment icon.


setScrollableTabbedPane

public static void setScrollableTabbedPane(javax.swing.JTabbedPane pane)
Sets the scrollable behavior of a JTabbedPane.


requestFocus

public static void requestFocus(java.awt.Window win,
                                java.awt.Component comp)
Focuses on the specified component as soon as the window becomes active.

Parameters:
win - The window
comp - The component

saveGeometry

public static void saveGeometry(java.awt.Window win,
                                java.lang.String name)
Saves a window geometry

Parameters:
win - The Window
name - Name of the properties containing the geometry

loadGeometry

public 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.

Parameters:
win - The Window
name - Name of the properties containing the geometry

message

public static void message(java.awt.Frame frame,
                           java.lang.String name,
                           java.lang.Object[] args)
Displays a dialog box. The title of the dialog is fetched from the 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.

Parameters:
frame - The frame to display the dialog for
name - The name of the dialog
args - Positional parameters to be substituted into the message text

error

public static void error(java.awt.Frame frame,
                         java.lang.String name,
                         java.lang.Object[] args)
Displays an error dialog box. The title of the dialog is fetched from the 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.

Parameters:
frame - The frame to display the dialog for
name - The name of the dialog
args - Positional parameters to be substituted into the message text

parseColor

public static java.awt.Color parseColor(java.lang.String name)
Converts a hex color value prefixed with #, for example #ff0088.

Parameters:
name - The color value

getColorHexString

public static java.lang.String getColorHexString(java.awt.Color c)
Converts a color object to its hex value. The hex value prefixed is with #, for example #ff0088.

Parameters:
c - The color object

parseStyle

public static SyntaxStyle parseStyle(java.lang.String str)
                              throws java.lang.IllegalArgumentException
Converts a style string to a style object.

Parameters:
str - The style string
Throws:
java.lang.IllegalArgumentException - if the style is invalid

getStyleString

public static java.lang.String getStyleString(SyntaxStyle style)
Converts a style into it's string representation.

Parameters:
style - The style

loadMenu

public static javax.swing.JMenu loadMenu(java.lang.String name)

loadMenu

public static javax.swing.JMenu loadMenu(java.lang.String name,
                                         boolean isLabel)
Loads a menu from the properties. The white space separated list of menu items is obtained from the property named name. The menu label is obtained from the name.label property.

Parameters:
name - The menu name
isLabel - True if name is label, too

loadMenuItem

public static javax.swing.JMenuItem loadMenuItem(java.lang.String action)
This method creates a new JMenuItem. This special version is targeted to be used with plugins.

Parameters:
action - Plugin action name
Returns:
A new JMenuItem

loadMenuItem

public 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. See menus/XMenuHandler.class for more informations about its usage.

Parameters:
label - The menu item label
action - The name of the action, specified in Jext
picture - Relative path to an icon
enabled - Disable the item if false
Returns:
A new JMenuItem

loadMenuItem

public 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. See menus/XMenuHandler.class for more informations about its usage.

Parameters:
label - The menu item label
action - The name of the action, specified in Jext
picture - Relative path to an icon
enabled - Disable the item if false
list - If true adds item info to a list
Returns:
A new JMenuItem


Copyright © 2002 Romain Guy.