Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.eireneh.swing
Class MenuUtil  view MenuUtil download MenuUtil.java

java.lang.Object
  extended bycom.eireneh.swing.MenuUtil

public class MenuUtil
extends java.lang.Object

Various Menu creation utilities.
Distribution Licence:
Project B is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
The License is available on the internet here, by writing to Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, Or locally at the Licence link below.
The copyright to this program is held by it's authors.


Nested Class Summary
private static class MenuUtil.ActionChangedListener
           
 
Field Summary
static java.lang.String actionSuffix
          Suffix applied to the key used in resource file lookups for an action.
private static java.util.Hashtable commands
           
static java.lang.String imageSuffix
          Suffix applied to the key used in resource file lookups for an image.
static java.lang.String labelSuffix
          Suffix applied to the key used in resource file lookups for a label.
private static java.util.Hashtable menuitems
           
private static java.util.ResourceBundle resource
           
static java.lang.String tipSuffix
          Suffix applied to the key used in resource file lookups for tooltip text.
 
Constructor Summary
MenuUtil()
           
 
Method Summary
static void addActions(javax.swing.Action[] actions)
           
protected static java.beans.PropertyChangeListener createActionChangeListener(javax.swing.JMenuItem b)
           
static javax.swing.JMenu createMenu(java.lang.String name)
          Create a menu for the app.
static javax.swing.JMenuBar createMenubar()
          Create the menubar for the app.
protected static javax.swing.JMenuItem createMenuItem(java.lang.String name)
          This is the hook through which all menu items are created.
protected static java.awt.Component createTool(java.lang.String key)
          Hook through which every toolbar item is created.
static java.awt.Component createToolbar()
          Create the toolbar.
protected static javax.swing.JButton createToolbarButton(java.lang.String key)
          Create a button to go inside of the toolbar.
protected static javax.swing.Action getAction(java.lang.String cmd)
           
protected  javax.swing.JMenuItem getMenuItem(java.lang.String cmd)
          Fetch the menu item that was created for the given command.
protected static java.net.URL getResource(java.lang.String key)
          Get a URL from a resource bundle
protected static java.lang.String getResourceString(java.lang.String name)
          Get a string from a resource bundle
static void setResourceBundle(java.util.ResourceBundle resource)
          Create the menubar for the app.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

imageSuffix

public static final java.lang.String imageSuffix
Suffix applied to the key used in resource file lookups for an image.

See Also:
Constant Field Values

labelSuffix

public static final java.lang.String labelSuffix
Suffix applied to the key used in resource file lookups for a label.

See Also:
Constant Field Values

actionSuffix

public static final java.lang.String actionSuffix
Suffix applied to the key used in resource file lookups for an action.

See Also:
Constant Field Values

tipSuffix

public static final java.lang.String tipSuffix
Suffix applied to the key used in resource file lookups for tooltip text.

See Also:
Constant Field Values

menuitems

private static java.util.Hashtable menuitems

commands

private static java.util.Hashtable commands

resource

private static java.util.ResourceBundle resource
Constructor Detail

MenuUtil

public MenuUtil()
Method Detail

setResourceBundle

public static void setResourceBundle(java.util.ResourceBundle resource)
Create the menubar for the app. By default this pulls the definition of the menu from the associated resource file.


addActions

public static void addActions(javax.swing.Action[] actions)

createMenubar

public static javax.swing.JMenuBar createMenubar()
Create the menubar for the app. By default this pulls the definition of the menu from the associated resource file.


createMenu

public static javax.swing.JMenu createMenu(java.lang.String name)
Create a menu for the app. By default this pulls the definition of the menu from the associated resource file.


createMenuItem

protected static javax.swing.JMenuItem createMenuItem(java.lang.String name)
This is the hook through which all menu items are created. It registers the result with the menuitem hashtable so that it can be fetched with getMenuItem().


getAction

protected static javax.swing.Action getAction(java.lang.String cmd)

getMenuItem

protected javax.swing.JMenuItem getMenuItem(java.lang.String cmd)
Fetch the menu item that was created for the given command.


createToolbar

public static java.awt.Component createToolbar()
Create the toolbar. By default this reads the resource file for the definition of the toolbar.


createTool

protected static java.awt.Component createTool(java.lang.String key)
Hook through which every toolbar item is created.


createToolbarButton

protected static javax.swing.JButton createToolbarButton(java.lang.String key)
Create a button to go inside of the toolbar. By default this will load an image resource. The image filename is relative to the classpath (including the '.' directory if its a part of the classpath), and may either be in a JAR file or a separate file.


createActionChangeListener

protected static java.beans.PropertyChangeListener createActionChangeListener(javax.swing.JMenuItem b)

getResourceString

protected static java.lang.String getResourceString(java.lang.String name)
Get a string from a resource bundle


getResource

protected static java.net.URL getResource(java.lang.String key)
Get a URL from a resource bundle