Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
java.awt

Class Menu

java.lang.Object
|
+--java.awt.MenuComponent
   |
   +--java.awt.MenuItem
      |
      +--java.awt.Menu

All Implemented Interfaces:

MenuContainer, Serializable, Serializable, Serializable


public class Menu

extends MenuItem

implements MenuContainer, Serializable

This class represents a pull down or tear off menu in Java's AWT.

Author:

Constructor Summary

Menu()

Initializes a new instance of Menu with no label and that is not a tearoff;
Menu(java.lang.String label)

Initializes a new instance of Menu that is not a tearoff and that has the specified label.
Menu(java.lang.String label, boolean isTearOff)

Initializes a new instance of Menu with the specified label and tearoff status.

Method Summary

java.awt.MenuItemadd(java.awt.MenuItem item)

Adds the specified item to this menu.
voidadd(java.lang.String label)

Add an item with the specified label to this menu.
voidaddNotify()

Creates the native peer for this object.
voidaddSeparator()

Adds a separator bar at the current menu location.
intcount()

Returns the number of items in this menu.
intcountItems()

Returns the number of items in this menu.
java.awt.MenuItemgetItem(int index)

Returns the item at the specified index.
intgetItemCount()

Returns the number of items in this menu.
voidinsert(java.awt.MenuItem item, int index)

Inserts the specified menu item into this menu at the specified index.
voidinsert(java.lang.String label, int index)

Inserts an item with the specified label into this menu at the specified index.
voidinsertSeparator(int index)

Inserts a separator bar at the specified index value.
booleanisTearOff()

Tests whether or not this menu is a tearoff.
java.lang.StringparamString()

Returns a debugging string for this menu.
synchronized voidremove(int index)

Deletes the item at the specified index from this menu.
voidremove(java.awt.MenuComponent item)

Removes the specifed item from the menu.
synchronized voidremoveAll()

Removes all the elements from this menu.
voidremoveNotify()

Destroys the native peer for this object.

Constructor Details

Menu

public Menu()

Initializes a new instance of Menu with no label and that is not a tearoff;

Throws:


Menu

public Menu(java.lang.String label)

Initializes a new instance of Menu that is not a tearoff and that has the specified label.

Parameters:

Throws:


Menu

public Menu(java.lang.String label, boolean isTearOff)

Initializes a new instance of Menu with the specified label and tearoff status.

Parameters:

Throws:


Method Details

add

public MenuItem add(java.awt.MenuItem item)

Adds the specified item to this menu. If it was previously part of another menu, it is first removed from that menu.

Parameters:

Returns:


add

public void add(java.lang.String label)

Add an item with the specified label to this menu.

Parameters:


addNotify

public void addNotify()

Creates the native peer for this object.


addSeparator

public void addSeparator()

Adds a separator bar at the current menu location.


count

public int count()

Returns the number of items in this menu.

Returns:


countItems

public int countItems()

Returns the number of items in this menu.

Returns:


getItem

public MenuItem getItem(int index)

Returns the item at the specified index.

Parameters:

Returns:

Throws:


getItemCount

public int getItemCount()

Returns the number of items in this menu.

Returns:


insert

public void insert(java.awt.MenuItem item, int index)

Inserts the specified menu item into this menu at the specified index.

Parameters:

Throws:


insert

public void insert(java.lang.String label, int index)

Inserts an item with the specified label into this menu at the specified index.

Parameters:

Throws:


insertSeparator

public void insertSeparator(int index)

Inserts a separator bar at the specified index value.

Parameters:

Throws:


isTearOff

public boolean isTearOff()

Tests whether or not this menu is a tearoff.

Returns:


paramString

public String paramString()

Returns a debugging string for this menu.

Returns:


remove

public synchronized void remove(int index)

Deletes the item at the specified index from this menu.

Parameters:

Throws:


remove

public void remove(java.awt.MenuComponent item)

Removes the specifed item from the menu. If the specified component does not exist, this method does nothing. // FIXME: Right?

Parameters:


removeAll

public synchronized void removeAll()

Removes all the elements from this menu.


removeNotify

public void removeNotify()

Destroys the native peer for this object.