Class MenuItem
All Packages Class Hierarchy This Package Previous Next Index
Class MenuItem
public class netscape.application.MenuItem
extends java.lang.Object
implements java.lang.Cloneable,
netscape.application.EventProcessor
{
/* Constructors
*/
public MenuItem();
public MenuItem(String, String, Target);
public MenuItem(String, char, String, Target);
/* Methods
*/
public Object clone();
public String command();
public char commandKey();
public Font font();
public boolean hasSubmenu();
public boolean isEnabled();
public void processEvent(Event);
public void sendCommand();
public void setCommand(String);
public void setCommandKey(char);
public void setEnabled(boolean);
public void setFont(Font);
public void setSubmenu(Menu);
public void setSupermenu(Menu);
public void setTarget(Target);
public void setTitle(String);
public Menu submenu();
public Menu supermenu();
public Target target();
public String title();
}
Object subclass representing a single item in a Menu. A MenuItem stores a
reference to a java.awt.MenuItem, which it uses as the actual menu item
control. A MenuItem may or may not have a submenu. In general, you don't
create MenuItems yourself, but instead use Menu's addItem() and
addItemWithSubmenu() methods.
- See Also:
- Menu
Constructors
MenuItem
public MenuItem()
- Constructs an empty MenuItem.
MenuItem
public MenuItem(String title,
String command,
Target target)
- Constructs a MenuItem with the specified title, command, and
Target.
MenuItem
public MenuItem(String title,
char key,
String command,
Target target)
- Constructs a MenuItem with the specified title, command key
equivalent, command, and Target.
Methods
clone
public Object clone()
- Clones the MenuItem. Menu adds addtional items by cloning its
prototype MenuItem.
- Overrides:
- clone in class Object
setSubmenu
public void setSubmenu(Menu aMenu)
- Sets this MenuItem to have the specified submenu.
submenu
public Menu submenu()
- Returns the MenuItem's submenu, null if it doesn't have one.
hasSubmenu
public boolean hasSubmenu()
- Returns true if this MenuItem has a submenu.
- See Also:
- setSubmenu
setSupermenu
public void setSupermenu(Menu aMenu)
- Sets the MenuItem's supermenu.
supermenu
public Menu supermenu()
- Returns the MenuItem's supermenu.
- See Also:
- setSupermenu
setCommandKey
public void setCommandKey(char key)
- Sets the MenuItem's command key equivalent.
commandKey
public char commandKey()
- Returns the MenuItem's command key equivalent, '\0' if it doesn't have
one.
- See Also:
- setCommandKey
setCommand
public void setCommand(String newCommand)
- Sets the MenuItem's command.
command
public String command()
- Returns the MenuItem's command.
- See Also:
- setCommand
setTarget
public void setTarget(Target aTarget)
- Sets the MenuItem's Target.
target
public Target target()
- Returns the MenuItem's Target.
- See Also:
- setTarget
processEvent
public void processEvent(Event event)
- Called by the EventLoop to process a selection event. Calls
sendCommand().
sendCommand
public void sendCommand()
- Tells the MenuItem to send its command to its Target.
- See Also:
- setTarget
setTitle
public void setTitle(String aString)
- Sets the MenuItem's title.
title
public String title()
- Returns the MenuItem's title.
setEnabled
public void setEnabled(boolean flag)
- Enables or disables the MenuItem. Disabled MenuItems cannot be
selected and render their title using Color.gray. If this MenuItem has
a submenu, it enables or disables it as well.
isEnabled
public boolean isEnabled()
- Returns true if the MenuItem is enabled.
- See Also:
- setEnabled
setFont
public void setFont(Font font)
- Sets the Font used to display the MenuItem's title.
font
public Font font()
- Returns the Font used to display the MenuItem's title.
- See Also:
- setFont
All Packages Class Hierarchy This Package Previous Next Index