jimm.datavision.gui
Class MenuUtils

java.lang.Object
  extended by jimm.datavision.gui.MenuUtils

public class MenuUtils
extends java.lang.Object

Menu creation utilities.

Author:
Jim Menard, jimm@io.com

Constructor Summary
MenuUtils()
           
 
Method Summary
static javax.swing.JCheckBoxMenuItem addCheckboxToMenu(java.awt.event.ActionListener listener, javax.swing.JMenu menu, java.lang.String key, java.awt.Font font)
          Adds a single checkbox item to a menu.
static javax.swing.JCheckBoxMenuItem addCheckboxToMenu(java.awt.event.ActionListener listener, javax.swing.JPopupMenu menu, java.lang.String key, java.awt.Font font)
          Adds a single checkbox item to a popup menu.
static javax.swing.JMenuItem addToMenu(java.awt.event.ActionListener listener, javax.swing.JMenu menu, java.lang.String key)
          Adds a single item to a menu.
static javax.swing.JMenuItem addToMenu(java.awt.event.ActionListener listener, javax.swing.JMenu menu, java.lang.String key, java.awt.Font font)
          Adds a single item to a menu.
static javax.swing.JMenuItem addToMenu(java.awt.event.ActionListener listener, javax.swing.JPopupMenu menu, java.lang.String key)
          Adds a single item to a popup menu.
static javax.swing.JMenuItem addToMenu(java.awt.event.ActionListener listener, javax.swing.JPopupMenu menu, java.lang.String key, java.awt.Font font)
          Adds a single item to a popup menu.
static javax.swing.JMenuItem addToMenu(javax.swing.JMenu menu, javax.swing.Action action, java.lang.String key)
          Adds an action to a menu.
static javax.swing.JMenu buildAlignMenu(java.awt.event.ActionListener listener, java.awt.Font font)
          Returns a new align menu.
static javax.swing.JMenu buildPaperSizeMenu(java.awt.event.ActionListener listener, PaperFormat currChoice, javax.swing.ButtonGroup orientationGroup, javax.swing.ButtonGroup nameGroup)
          Returns a new paper size menu.
static javax.swing.JMenu buildSizeMenu(java.awt.event.ActionListener listener, java.awt.Font font)
          Returns a new size menu.
protected static void modifyItem(javax.swing.JMenuItem item, java.awt.event.ActionListener listener, java.lang.String key, java.awt.Font font)
           
static javax.swing.JCheckBoxMenuItem readCheckboxItem(java.awt.event.ActionListener listener, java.lang.String key, java.awt.Font font)
           
static javax.swing.JMenuItem readItem(java.awt.event.ActionListener listener, java.lang.String key, java.awt.Font font)
           
static javax.swing.JMenu readMenu(java.lang.String key)
           
protected static void setKeys(javax.swing.JMenuItem item, java.lang.String key)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MenuUtils

public MenuUtils()
Method Detail

readMenu

public static javax.swing.JMenu readMenu(java.lang.String key)

readItem

public static javax.swing.JMenuItem readItem(java.awt.event.ActionListener listener,
                                             java.lang.String key,
                                             java.awt.Font font)

readCheckboxItem

public static javax.swing.JCheckBoxMenuItem readCheckboxItem(java.awt.event.ActionListener listener,
                                                             java.lang.String key,
                                                             java.awt.Font font)

modifyItem

protected static void modifyItem(javax.swing.JMenuItem item,
                                 java.awt.event.ActionListener listener,
                                 java.lang.String key,
                                 java.awt.Font font)

addToMenu

public static javax.swing.JMenuItem addToMenu(java.awt.event.ActionListener listener,
                                              javax.swing.JMenu menu,
                                              java.lang.String key)
Adds a single item to a menu.

Parameters:
listener - action listener for item; may be null
menu - the menu
key - the menu properties file lookup key

addToMenu

public static javax.swing.JMenuItem addToMenu(java.awt.event.ActionListener listener,
                                              javax.swing.JMenu menu,
                                              java.lang.String key,
                                              java.awt.Font font)
Adds a single item to a menu.

Parameters:
listener - action listener for item; may be null
menu - the menu
key - the menu properties file lookup key
font - font; may be null

addToMenu

public static javax.swing.JMenuItem addToMenu(java.awt.event.ActionListener listener,
                                              javax.swing.JPopupMenu menu,
                                              java.lang.String key)
Adds a single item to a popup menu.

Parameters:
listener - action listener for item; may be null
menu - the menu
key - the menu properties file lookup key

addToMenu

public static javax.swing.JMenuItem addToMenu(java.awt.event.ActionListener listener,
                                              javax.swing.JPopupMenu menu,
                                              java.lang.String key,
                                              java.awt.Font font)
Adds a single item to a popup menu.

Parameters:
listener - action listener for item; may be null
menu - the menu
key - the menu properties file lookup key
font - font; may be null

addCheckboxToMenu

public static javax.swing.JCheckBoxMenuItem addCheckboxToMenu(java.awt.event.ActionListener listener,
                                                              javax.swing.JMenu menu,
                                                              java.lang.String key,
                                                              java.awt.Font font)
Adds a single checkbox item to a menu.

Parameters:
listener - action listener for item; may be null
menu - the menu
key - the menu properties file lookup key
font - font; may be null

addCheckboxToMenu

public static javax.swing.JCheckBoxMenuItem addCheckboxToMenu(java.awt.event.ActionListener listener,
                                                              javax.swing.JPopupMenu menu,
                                                              java.lang.String key,
                                                              java.awt.Font font)
Adds a single checkbox item to a popup menu.

Parameters:
listener - action listener for item; may be null
menu - the menu
key - the menu properties file lookup key
font - font; may be null

addToMenu

public static javax.swing.JMenuItem addToMenu(javax.swing.JMenu menu,
                                              javax.swing.Action action,
                                              java.lang.String key)
Adds an action to a menu.

Parameters:
menu - the menu
action - the action
key - the menu properties file lookup key

setKeys

protected static void setKeys(javax.swing.JMenuItem item,
                              java.lang.String key)

buildAlignMenu

public static javax.swing.JMenu buildAlignMenu(java.awt.event.ActionListener listener,
                                               java.awt.Font font)
Returns a new align menu.

Parameters:
listener - action listener for item; may be null
font - font; may be null
Returns:
a new menu

buildSizeMenu

public static javax.swing.JMenu buildSizeMenu(java.awt.event.ActionListener listener,
                                              java.awt.Font font)
Returns a new size menu.

Parameters:
listener - action listener for item; may be null
font - font; may be null
Returns:
a new menu

buildPaperSizeMenu

public static javax.swing.JMenu buildPaperSizeMenu(java.awt.event.ActionListener listener,
                                                   PaperFormat currChoice,
                                                   javax.swing.ButtonGroup orientationGroup,
                                                   javax.swing.ButtonGroup nameGroup)
Returns a new paper size menu.

Parameters:
listener - action button listener for item; may be null
currChoice - current paper choice (its orientation and name will be pre-selected)
orientationGroup - a radio button group for orientations
nameGroup - a radio button group for names
Returns:
a new menu