java.awt
Class MenuComponent

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.awt.MenuComponent
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable
Direct Known Subclasses:
MenuBar sample code for java.awt.MenuBar definition code for java.awt.MenuBar , MenuItem sample code for java.awt.MenuItem definition code for java.awt.MenuItem

public abstract class MenuComponent
extends Object sample code for java.lang.Object definition code for java.lang.Object
implements Serializable sample code for java.io.Serializable definition code for java.io.Serializable

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.

Since:
JDK1.0
See Also:
Serialized Form

Nested Class Summary
protected  class MenuComponent.AccessibleAWTMenuComponent sample code for java.awt.MenuComponent.AccessibleAWTMenuComponent definition code for java.awt.MenuComponent.AccessibleAWTMenuComponent
          Inner class of MenuComponent used to provide default support for accessibility.
 
Constructor Summary
MenuComponent sample code for java.awt.MenuComponent.MenuComponent() definition code for java.awt.MenuComponent.MenuComponent() ()
          Creates a MenuComponent.
 
Method Summary
 void dispatchEvent sample code for java.awt.MenuComponent.dispatchEvent(java.awt.AWTEvent) definition code for java.awt.MenuComponent.dispatchEvent(java.awt.AWTEvent) (AWTEvent sample code for java.awt.AWTEvent definition code for java.awt.AWTEvent  e)
           
 AccessibleContext sample code for javax.accessibility.AccessibleContext definition code for javax.accessibility.AccessibleContext getAccessibleContext sample code for java.awt.MenuComponent.getAccessibleContext() definition code for java.awt.MenuComponent.getAccessibleContext() ()
          Gets the AccessibleContext associated with this MenuComponent.
 Font sample code for java.awt.Font definition code for java.awt.Font getFont sample code for java.awt.MenuComponent.getFont() definition code for java.awt.MenuComponent.getFont() ()
          Gets the font used for this menu component.
 String sample code for java.lang.String definition code for java.lang.String getName sample code for java.awt.MenuComponent.getName() definition code for java.awt.MenuComponent.getName() ()
          Gets the name of the menu component.
 MenuContainer sample code for java.awt.MenuContainer definition code for java.awt.MenuContainer getParent sample code for java.awt.MenuComponent.getParent() definition code for java.awt.MenuComponent.getParent() ()
          Returns the parent container for this menu component.
 MenuComponentPeer sample code for java.awt.peer.MenuComponentPeer definition code for java.awt.peer.MenuComponentPeer getPeer sample code for java.awt.MenuComponent.getPeer() definition code for java.awt.MenuComponent.getPeer() ()
          Deprecated. As of JDK version 1.1, programs should not directly manipulate peers.
protected  Object sample code for java.lang.Object definition code for java.lang.Object getTreeLock sample code for java.awt.MenuComponent.getTreeLock() definition code for java.awt.MenuComponent.getTreeLock() ()
          Gets this component's locking object (the object that owns the thread sychronization monitor) for AWT component-tree and layout operations.
protected  String sample code for java.lang.String definition code for java.lang.String paramString sample code for java.awt.MenuComponent.paramString() definition code for java.awt.MenuComponent.paramString() ()
          Returns a string representing the state of this MenuComponent.
 boolean postEvent sample code for java.awt.MenuComponent.postEvent(java.awt.Event) definition code for java.awt.MenuComponent.postEvent(java.awt.Event) (Event sample code for java.awt.Event definition code for java.awt.Event  evt)
          Deprecated. As of JDK version 1.1, replaced by dispatchEvent sample code for java.awt.MenuComponent.dispatchEvent(java.awt.AWTEvent) definition code for java.awt.MenuComponent.dispatchEvent(java.awt.AWTEvent) .
protected  void processEvent sample code for java.awt.MenuComponent.processEvent(java.awt.AWTEvent) definition code for java.awt.MenuComponent.processEvent(java.awt.AWTEvent) (AWTEvent sample code for java.awt.AWTEvent definition code for java.awt.AWTEvent  e)
          Processes events occurring on this menu component.
 void removeNotify sample code for java.awt.MenuComponent.removeNotify() definition code for java.awt.MenuComponent.removeNotify() ()
          Removes the menu component's peer.
 void setFont sample code for java.awt.MenuComponent.setFont(java.awt.Font) definition code for java.awt.MenuComponent.setFont(java.awt.Font) (Font sample code for java.awt.Font definition code for java.awt.Font  f)
          Sets the font to be used for this menu component to the specified font.
 void setName sample code for java.awt.MenuComponent.setName(java.lang.String) definition code for java.awt.MenuComponent.setName(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  name)
          Sets the name of the component to the specified string.
 String sample code for java.lang.String definition code for java.lang.String toString sample code for java.awt.MenuComponent.toString() definition code for java.awt.MenuComponent.toString() ()
          Returns a representation of this menu component as a string.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

MenuComponent sample code for java.awt.MenuComponent() definition code for java.awt.MenuComponent()

public MenuComponent()
              throws HeadlessException sample code for java.awt.HeadlessException definition code for java.awt.HeadlessException 
Creates a MenuComponent.

Throws:
HeadlessException sample code for java.awt.HeadlessException definition code for java.awt.HeadlessException - if GraphicsEnvironment.isHeadless returns true
See Also:
GraphicsEnvironment.isHeadless() sample code for java.awt.GraphicsEnvironment.isHeadless() definition code for java.awt.GraphicsEnvironment.isHeadless()
Method Detail

getName sample code for java.awt.MenuComponent.getName() definition code for java.awt.MenuComponent.getName()

public String sample code for java.lang.String definition code for java.lang.String  getName()
Gets the name of the menu component.

Returns:
the name of the menu component
Since:
JDK1.1
See Also:
setName(java.lang.String) sample code for java.awt.MenuComponent.setName(java.lang.String) definition code for java.awt.MenuComponent.setName(java.lang.String)

setName sample code for java.awt.MenuComponent.setName(java.lang.String) definition code for java.awt.MenuComponent.setName(java.lang.String)

public void setName(String sample code for java.lang.String definition code for java.lang.String  name)
Sets the name of the component to the specified string.

Parameters:
name - the name of the menu component
Since:
JDK1.1
See Also:
getName() sample code for java.awt.MenuComponent.getName() definition code for java.awt.MenuComponent.getName()

getParent sample code for java.awt.MenuComponent.getParent() definition code for java.awt.MenuComponent.getParent()

public MenuContainer sample code for java.awt.MenuContainer definition code for java.awt.MenuContainer  getParent()
Returns the parent container for this menu component.

Returns:
the menu component containing this menu component, or null if this menu component is the outermost component, the menu bar itself

getPeer sample code for java.awt.MenuComponent.getPeer() definition code for java.awt.MenuComponent.getPeer()

@Deprecated
public MenuComponentPeer sample code for java.awt.peer.MenuComponentPeer definition code for java.awt.peer.MenuComponentPeer  getPeer()
Deprecated. As of JDK version 1.1, programs should not directly manipulate peers.


getFont sample code for java.awt.MenuComponent.getFont() definition code for java.awt.MenuComponent.getFont()

public Font sample code for java.awt.Font definition code for java.awt.Font  getFont()
Gets the font used for this menu component.

Returns:
the font used in this menu component, if there is one; null otherwise
See Also:
setFont(java.awt.Font) sample code for java.awt.MenuComponent.setFont(java.awt.Font) definition code for java.awt.MenuComponent.setFont(java.awt.Font)

setFont sample code for java.awt.MenuComponent.setFont(java.awt.Font) definition code for java.awt.MenuComponent.setFont(java.awt.Font)

public void setFont(Font sample code for java.awt.Font definition code for java.awt.Font  f)
Sets the font to be used for this menu component to the specified font. This font is also used by all subcomponents of this menu component, unless those subcomponents specify a different font.

Some platforms may not support setting of all font attributes of a menu component; in such cases, calling setFont will have no effect on the unsupported font attributes of this menu component. Unless subcomponents of this menu component specify a different font, this font will be used by those subcomponents if supported by the underlying platform.

Parameters:
f - the font to be set
See Also:
getFont() sample code for java.awt.MenuComponent.getFont() definition code for java.awt.MenuComponent.getFont() , Font.getAttributes() sample code for java.awt.Font.getAttributes() definition code for java.awt.Font.getAttributes() , TextAttribute sample code for java.awt.font.TextAttribute definition code for java.awt.font.TextAttribute

removeNotify sample code for java.awt.MenuComponent.removeNotify() definition code for java.awt.MenuComponent.removeNotify()

public void removeNotify()
Removes the menu component's peer. The peer allows us to modify the appearance of the menu component without changing the functionality of the menu component.


postEvent sample code for java.awt.MenuComponent.postEvent(java.awt.Event) definition code for java.awt.MenuComponent.postEvent(java.awt.Event)

@Deprecated
public boolean postEvent(Event sample code for java.awt.Event definition code for java.awt.Event  evt)
Deprecated. As of JDK version 1.1, replaced by dispatchEvent sample code for java.awt.MenuComponent.dispatchEvent(java.awt.AWTEvent) definition code for java.awt.MenuComponent.dispatchEvent(java.awt.AWTEvent) .

Posts the specified event to the menu. This method is part of the Java 1.0 event system and it is maintained only for backwards compatibility. Its use is discouraged, and it may not be supported in the future.

Parameters:
evt - the event which is to take place

dispatchEvent sample code for java.awt.MenuComponent.dispatchEvent(java.awt.AWTEvent) definition code for java.awt.MenuComponent.dispatchEvent(java.awt.AWTEvent)

public final void dispatchEvent(AWTEvent sample code for java.awt.AWTEvent definition code for java.awt.AWTEvent  e)

processEvent sample code for java.awt.MenuComponent.processEvent(java.awt.AWTEvent) definition code for java.awt.MenuComponent.processEvent(java.awt.AWTEvent)

protected void processEvent(AWTEvent sample code for java.awt.AWTEvent definition code for java.awt.AWTEvent  e)
Processes events occurring on this menu component.

Note that if the event parameter is null the behavior is unspecified and may result in an exception.

Parameters:
e - the event
Since:
JDK1.1

paramString sample code for java.awt.MenuComponent.paramString() definition code for java.awt.MenuComponent.paramString()

protected String sample code for java.lang.String definition code for java.lang.String  paramString()
Returns a string representing the state of this MenuComponent. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.

Returns:
the parameter string of this menu component

toString sample code for java.awt.MenuComponent.toString() definition code for java.awt.MenuComponent.toString()

public String sample code for java.lang.String definition code for java.lang.String  toString()
Returns a representation of this menu component as a string.

Overrides:
toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
a string representation of this menu component

getTreeLock sample code for java.awt.MenuComponent.getTreeLock() definition code for java.awt.MenuComponent.getTreeLock()

protected final Object sample code for java.lang.Object definition code for java.lang.Object  getTreeLock()
Gets this component's locking object (the object that owns the thread sychronization monitor) for AWT component-tree and layout operations.

Returns:
this component's locking object

getAccessibleContext sample code for java.awt.MenuComponent.getAccessibleContext() definition code for java.awt.MenuComponent.getAccessibleContext()

public AccessibleContext sample code for javax.accessibility.AccessibleContext definition code for javax.accessibility.AccessibleContext  getAccessibleContext()
Gets the AccessibleContext associated with this MenuComponent. The method implemented by this base class returns null. Classes that extend MenuComponent should implement this method to return the AccessibleContext associated with the subclass.

Returns:
the AccessibleContext of this MenuComponent