org.browsecode.helpers.menus
Class MenuItemJMenuItem

java.lang.Object
  extended by org.browsecode.helpers.menus.MenuItemStub
      extended by org.browsecode.helpers.menus.MenuItemJMenuItem
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener, MenuItem
Direct Known Subclasses:
CheckboxMenuItemJCheckbox

public class MenuItemJMenuItem
extends MenuItemStub
implements java.awt.event.ActionListener


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.browsecode.helpers.menus.MenuItem
MenuItem.MenuItemSelectedListener
 
Field Summary
protected  javax.swing.JMenuItem jMenuItem
           
 
Constructor Summary
protected MenuItemJMenuItem(MenuBarHelper menuBarHelper, javax.swing.JMenuItem menuItem, java.lang.String title, javax.swing.KeyStroke keyStroke)
           
  MenuItemJMenuItem(MenuBarHelper menuBarHelper, java.lang.String title, javax.swing.Icon icon)
           
  MenuItemJMenuItem(MenuBarHelper menuBarHelper, java.lang.String title, javax.swing.Icon icon, javax.swing.KeyStroke keyStroke)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          The underlying JMenuItem.
 java.awt.Font getFont()
          Gets the font.
 java.lang.String getVisibleTitle()
          Get the visible title of the menu item.
 boolean setBackgroundColor(java.awt.Color color)
          Sets the background color.
 boolean setEnabledDisabled()
          If you have enabled or disabled this menu item, call this.
 boolean setFont(java.awt.Font font)
          Sets the font.
 boolean setForegroundColor(java.awt.Color color)
          Sets the foreground color.
 boolean setToolTipText(java.lang.String helpText)
          Set help text.
protected  void setVisibleTitleAfterTranslation(java.lang.String title)
          Implement this to set the visible title.
 
Methods inherited from class org.browsecode.helpers.menus.MenuItemStub
addActionListener, canAListenerHandleAction, fireAction, getMenuBarHelper, getTitle, removeActionListener, setTitle, setVisibleTitle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jMenuItem

protected javax.swing.JMenuItem jMenuItem
Constructor Detail

MenuItemJMenuItem

public MenuItemJMenuItem(MenuBarHelper menuBarHelper,
                         java.lang.String title,
                         javax.swing.Icon icon)

MenuItemJMenuItem

public MenuItemJMenuItem(MenuBarHelper menuBarHelper,
                         java.lang.String title,
                         javax.swing.Icon icon,
                         javax.swing.KeyStroke keyStroke)

MenuItemJMenuItem

protected MenuItemJMenuItem(MenuBarHelper menuBarHelper,
                            javax.swing.JMenuItem menuItem,
                            java.lang.String title,
                            javax.swing.KeyStroke keyStroke)
Method Detail

getVisibleTitle

public java.lang.String getVisibleTitle()
Description copied from interface: MenuItem
Get the visible title of the menu item. This is the current title and is language dependent. For example, if you want the "Undo" menu item to change from "Undo" to "Undo text insert", set it here. This will make the MenuItem's title stay as "Undo" for reference, but visibly it will show "Undo text insert"

Specified by:
getVisibleTitle in interface MenuItem
Returns:
Returns the title.

setVisibleTitleAfterTranslation

protected void setVisibleTitleAfterTranslation(java.lang.String title)
Description copied from class: MenuItemStub
Implement this to set the visible title. Don't override setVisibleTitle, override this one -- so that you will be setting the translated text for the menu.

Specified by:
setVisibleTitleAfterTranslation in class MenuItemStub

setForegroundColor

public boolean setForegroundColor(java.awt.Color color)
Description copied from interface: MenuItem
Sets the foreground color. Might not work.

Specified by:
setForegroundColor in interface MenuItem
Overrides:
setForegroundColor in class MenuItemStub
Returns:
whether it suceeded or not (if it's not enabled for this type of MenuItem, it returns false)

setBackgroundColor

public boolean setBackgroundColor(java.awt.Color color)
Description copied from interface: MenuItem
Sets the background color. Might not work.

Specified by:
setBackgroundColor in interface MenuItem
Overrides:
setBackgroundColor in class MenuItemStub
Returns:
whether it suceeded or not (if it's not enabled for this type of MenuItem, it returns false)

getFont

public java.awt.Font getFont()
Description copied from interface: MenuItem
Gets the font. Might not work.

Specified by:
getFont in interface MenuItem
Overrides:
getFont in class MenuItemStub
Returns:
null if it failed, and the Font if it worked.

setFont

public boolean setFont(java.awt.Font font)
Description copied from interface: MenuItem
Sets the font. Might not work.

Specified by:
setFont in interface MenuItem
Overrides:
setFont in class MenuItemStub
Returns:
whether it suceeded or not (if it's not enabled for this type of MenuItem, it returns false)

setToolTipText

public boolean setToolTipText(java.lang.String helpText)
Description copied from interface: MenuItem
Set help text. Might not work.

Specified by:
setToolTipText in interface MenuItem
Overrides:
setToolTipText in class MenuItemStub
Returns:
whether it suceeded or not (if it's not enabled for this type of MenuItem, it returns false)

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
The underlying JMenuItem. Note that it's not a good policy to rely on this in this class, since it may change at some point in the future to a system that does not use JMenuItems. (If another menu system every gets created, it could use that instead).

Specified by:
actionPerformed in interface java.awt.event.ActionListener

setEnabledDisabled

public boolean setEnabledDisabled()
Description copied from interface: MenuItem
If you have enabled or disabled this menu item, call this. Note that you do not need to pass the state in, because it will check in MenuItemSelectedListener.canHandleActionNow() -- make sure you have added one and that it's returning the correct thing.

Specified by:
setEnabledDisabled in interface MenuItem
Returns:
whether or not it can be disabled and re-enabled. In general, this returns true. For some items that can't be disabled, it returns false.