org.brains2b.swingext.gui
Class GuiItemFactory

java.lang.Object
  extended by org.brains2b.swingext.gui.GuiItemFactory

public class GuiItemFactory
extends java.lang.Object

Factory class to create Swing components mostly from an Action

Version:
[version] [Jul 6, 2007]
Author:
dennis@brains2b.nl

Method Summary
static javax.swing.JMenu createMenu(java.lang.String label, char mnemonic)
          Create a JMenu with a mnemonic
static javax.swing.JMenuItem createMenuItem(javax.swing.JMenuItem parent, javax.swing.Action action)
          Create a JMenuItem on the basis of an Action and add it to the parent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createMenu

public static final javax.swing.JMenu createMenu(java.lang.String label,
                                                 char mnemonic)
Create a JMenu with a mnemonic

Parameters:
label - String, the label for this menu
mnemonic - char, the mnemonic for this JMenu
Returns:
JMenu, the menu created
See Also:
JMenuItem

createMenuItem

public static final javax.swing.JMenuItem createMenuItem(javax.swing.JMenuItem parent,
                                                         javax.swing.Action action)
Create a JMenuItem on the basis of an Action and add it to the parent.

If UIManager property GuiItem.MenuItem.showIcon is set the JMenuItem will show an Icon if it is part of the Action.

The accelerator is copied from the Action seperatly, because it is not used from the Action directly.

Note: While JMenu is just another JMenuItem you can add JMenuItem's to any JMenu, or to a JMenuItem

Parameters:
parent - JMenuItem, the menu item to add this menu item to.
action - Action, the action to create the JMenuItem from.
Returns:
JMenuItem, the menu item created from the Action