ix.iface.util
Class IFUtil

java.lang.Object
  extended by ix.iface.util.IFUtil

public class IFUtil
extends java.lang.Object

Class for static utilities.


Method Summary
static void addMenuBarItem(javax.swing.JFrame frame, java.lang.String menuName, javax.swing.JMenuItem item)
          Adds an item to a menu in a frame's menu bar.
static void adjustLookAndFeel()
          Makes any standard I-X changes to the look and feel.
static javax.swing.JMenu ensureMenuBarMenu(javax.swing.JFrame frame, java.lang.String menuName)
          Ensures that a frame's menu bar contains a menu of the specified name, creating a menu and adding it if it is not alreay present.
static javax.swing.JMenu getMenuBarMenu(javax.swing.JMenuBar bar, java.lang.String menuName, boolean mustHave)
          Returns the named menu from a menu bar if the menu exists.
static javax.swing.JButton makeButton(java.lang.String text, java.awt.event.ActionListener lis)
          Creates a button with the specified action Listener placed inside a CatchingActionListener.
static javax.swing.JButton makeButton(java.lang.String text, boolean enabled, java.awt.event.ActionListener lis)
          Creates a button with the specified action Listener placed inside a CatchingActionListener.
static javax.swing.JMenuItem makeMenuItem(java.lang.String text, java.awt.event.ActionListener lis)
          Creates a menu-item with the specified action Listener placed inside a CatchingActionListener.
static javax.swing.JMenuItem makeMenuItem(java.lang.String text, boolean enabled, java.awt.event.ActionListener lis)
          Creates a menu-item, enabled or not, with the specified action Listener placed inside a CatchingActionListener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

adjustLookAndFeel

public static void adjustLookAndFeel()
Makes any standard I-X changes to the look and feel.

See Also:
IXMetalTheme

makeButton

public static javax.swing.JButton makeButton(java.lang.String text,
                                             java.awt.event.ActionListener lis)
Creates a button with the specified action Listener placed inside a CatchingActionListener.


makeButton

public static javax.swing.JButton makeButton(java.lang.String text,
                                             boolean enabled,
                                             java.awt.event.ActionListener lis)
Creates a button with the specified action Listener placed inside a CatchingActionListener.


makeMenuItem

public static javax.swing.JMenuItem makeMenuItem(java.lang.String text,
                                                 java.awt.event.ActionListener lis)
Creates a menu-item with the specified action Listener placed inside a CatchingActionListener.


makeMenuItem

public static javax.swing.JMenuItem makeMenuItem(java.lang.String text,
                                                 boolean enabled,
                                                 java.awt.event.ActionListener lis)
Creates a menu-item, enabled or not, with the specified action Listener placed inside a CatchingActionListener.


addMenuBarItem

public static void addMenuBarItem(javax.swing.JFrame frame,
                                  java.lang.String menuName,
                                  javax.swing.JMenuItem item)
Adds an item to a menu in a frame's menu bar. If the bar does not already contain a menu of the specified name, one is created and added to the bar. The frame must be a JFrame and already have a JMenuBar.

Parameters:
frame - the frame
menuName - the text of a menu in the frame's menu bar.
item - the menu item to add
See Also:
ensureMenuBarMenu(JFrame frame, String menuName)

ensureMenuBarMenu

public static javax.swing.JMenu ensureMenuBarMenu(javax.swing.JFrame frame,
                                                  java.lang.String menuName)
Ensures that a frame's menu bar contains a menu of the specified name, creating a menu and adding it if it is not alreay present. The menu is returned. The frame must be a JFrame and already have a JMenuBar.

Parameters:
frame - the frame
menuName - the text of a menu in the frame's menu bar.

getMenuBarMenu

public static javax.swing.JMenu getMenuBarMenu(javax.swing.JMenuBar bar,
                                               java.lang.String menuName,
                                               boolean mustHave)
Returns the named menu from a menu bar if the menu exists.

Parameters:
bar - the menu bar
menuName - the text of a menu in the bar
mustHave - whether to throw an exception or return null if the specified menu does not exist.