Top Description Inners Fields Constructors Methods
java.awt

public abstract Class MenuComponent

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Known Direct Subclasses
java.awt.MenuItem, java.awt.MenuBar
Imports
java.awt.event.ActionEvent, java.awt.peer.MenuComponentPeer, java.io.IOException, .ObjectInputStream, .Serial, java.security.AccessControlContext, .AccessController, javax.accessibility.Accessible, .AccessibleComponent, .AccessibleContext, .AccessibleRole, .AccessibleSelection, .AccessibleState, .AccessibleStateSet, sun.awt.AWTAccessor, .AppContext, .ComponentFactory

The abstract class MenuComponent is the superclass of all menu-related components. In this respect, the class MenuComponent is analogous to the abstract superclass Component for AWT components.

Menu components receive and process AWT events, just as components do, through the method processEvent.

Author
Arthur van Hoff
Since
1.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected abstract class
MenuComponent.AccessibleAWTMenuComponent

Inner class of MenuComponent used to provide default support for accessibility.

Field Summary

Modifier and TypeField and Description
private transient volatile AccessControlContext
acc

Deprecated as a consequence of AccessControlContext being deprecated.
pack-priv AccessibleContext
accessibleContext

MenuComponent will contain all of the methods in interface Accessible, though it won't actually implement the interface - that will be up to the individual objects which extend MenuComponent.

pack-priv static final String
private transient volatile AppContext
appContext

The AppContext of the MenuComponent.

private volatile Font
font

The menu component's font.

pack-priv static final String
private volatile String
name

The menu component's name, which defaults to null.

private volatile boolean
nameExplicitlySet

A variable to indicate whether a name is explicitly set.

pack-priv volatile boolean
newEventsOnly

Defaults to false.

pack-priv transient volatile MenuContainer
pack-priv transient volatile MenuComponentPeer
private static final long
serialVersionUID

Use serialVersionUID from JDK 1.1 for interoperability.

Constructor Summary

AccessConstructor and Description

Method Summary

Modifier and TypeMethod and Description
pack-priv String

Returns:

a name for this MenuComponent
constructComponentName
()

Constructs a name for this MenuComponent.

public final void
dispatchEvent(AWTEvent
the event
e
)

Delivers an event to this component or one of its sub components.

pack-priv void
pack-priv boolean
pack-priv final AccessControlContext
getAccessControlContext()

Deprecated as a consequence of AccessControlContext being deprecated.
pack-priv int

Returns:

-1 if this object doesn't contain the child, otherwise, index of the child.
getAccessibleChildIndex
(MenuComponent
MenuComponent whose index we are interested in.
child
)

Gets the index of the child within this MenuComponent.

public AccessibleContext

Returns:

the AccessibleContext of this MenuComponent
getAccessibleContext
()

Gets the AccessibleContext associated with this MenuComponent.

pack-priv int

Returns:

-1 if this object does not have an accessible parent; otherwise, the index of the child in its accessible parent.
getAccessibleIndexInParent
()

Gets the index of this object in its accessible parent.

pack-priv AccessibleStateSet

Returns:

an instance of AccessibleStateSet containing the current state set of the object
getAccessibleStateSet
()

Gets the state of this object.

pack-priv final ComponentFactory
public Font

Returns:

the font used in this menu component, if there is one; null otherwise
getFont
()

Gets the font used for this menu component.

pack-priv final Font
public String

Returns:

the name of the menu component
getName
()

Gets the name of the menu component.

public MenuContainer

Returns:

the menu component containing this menu component, or null if this menu component is the outermost component, the menu bar itself
getParent
()

Returns the parent container for this menu component.

pack-priv final MenuContainer
protected final Object

Returns:

this component's locking object
getTreeLock
()

Gets this component's locking object (the object that owns the thread synchronization monitor) for AWT component-tree and layout operations.

protected String

Returns:

the parameter string of this menu component
paramString
()

Returns a string representing the state of this MenuComponent.

public boolean

Returns:

unconditionally returns false
postEvent
(Event
the event which is to take place
evt
)

Deprecated As of JDK version 1.1, replaced by dispatchEvent.
Posts the specified event to the menu.
protected void
processEvent(AWTEvent
the event
e
)

Processes events occurring on this menu component.

private void
readObject(ObjectInputStream
the ObjectInputStream to read
s
)

Reads the menu component from an object input stream.

public void
removeNotify()

Removes the menu component's peer.

public void
setFont(Font
the font to be set
f
)

Sets the font to be used for this menu component to the specified font.

public void
setName(String
the name of the menu component
name
)

Sets the name of the component to the specified string.

public String

Returns:

a string representation of this menu component
toString
()

Overrides java.lang.Object.toString.

Returns a representation of this menu component as a string.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait