org.browsecode.helpers.menus
Interface MenuItem

All Known Subinterfaces:
CheckboxMenuItem, Menu
All Known Implementing Classes:
CheckboxMenuItemJCheckbox, MenuItemAppleOSX, MenuItemAppleOSX.AboutMenuItem, MenuItemAppleOSX.PrefsMenuItem, MenuItemAppleOSX.QuitMenuItem, MenuItemJMenuItem, MenuItemJSeparator, MenuItemStub, MenuJMenu, MenuStub

public interface MenuItem


Nested Class Summary
static interface MenuItem.MenuItemSelectedListener
          Like ActionListener, except that it tells you whether it has handled the action.
 
Method Summary
 void addActionListener(MenuItem.MenuItemSelectedListener actionListener)
           
 java.awt.Font getFont()
          Gets the font.
 java.lang.String getTitle()
          Get the title that is used to get and refer to this item.
 java.lang.String getVisibleTitle()
          Get the visible title of the menu item.
 boolean removeActionListener(MenuItem.MenuItemSelectedListener actionListener)
           
 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.
 void setVisibleTitle(java.lang.String title)
          Set the visible title of the menu item.
 

Method Detail

getTitle

java.lang.String getTitle()
Get the title that is used to get and refer to this item. It is language/locale independent and may not actually be the visible title of the item. This should generally not be changed over the course of the menu item's life.

Parameters:
title -

setVisibleTitle

void setVisibleTitle(java.lang.String title)
Set 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"

Parameters:
title -

getVisibleTitle

java.lang.String getVisibleTitle()
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"

Returns:

addActionListener

void addActionListener(MenuItem.MenuItemSelectedListener actionListener)

removeActionListener

boolean removeActionListener(MenuItem.MenuItemSelectedListener actionListener)

setEnabledDisabled

boolean setEnabledDisabled()
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.

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.

setForegroundColor

boolean setForegroundColor(java.awt.Color color)
Sets the foreground color. Might not work.

Parameters:
color -
Returns:
whether it suceeded or not (if it's not enabled for this type of MenuItem, it returns false)

setBackgroundColor

boolean setBackgroundColor(java.awt.Color color)
Sets the background color. Might not work.

Parameters:
color -
Returns:
whether it suceeded or not (if it's not enabled for this type of MenuItem, it returns false)

getFont

java.awt.Font getFont()
Gets the font. Might not work.

Parameters:
color -
Returns:
null if it failed, and the Font if it worked.

setFont

boolean setFont(java.awt.Font font)
Sets the font. Might not work.

Parameters:
color -
Returns:
whether it suceeded or not (if it's not enabled for this type of MenuItem, it returns false)

setToolTipText

boolean setToolTipText(java.lang.String helpText)
Set help text. Might not work.

Parameters:
helpText -
Returns:
whether it suceeded or not (if it's not enabled for this type of MenuItem, it returns false)