Methods Summary |
---|
java.lang.String | constructComponentName()Constructs a name for this MenuComponent .
Called by getName when the name is null .
return null; // For strict compliance with prior platform versions, a MenuComponent
// that doesn't set its name should return null from
// getName()
|
public final void | dispatchEvent(java.awt.AWTEvent e)Delivers an event to this component or one of its sub components.
dispatchEventImpl(e);
|
void | dispatchEventImpl(java.awt.AWTEvent e)
EventQueue.setCurrentEventAndMostRecentTime(e);
Toolkit.getDefaultToolkit().notifyAWTEventListeners(e);
if (newEventsOnly ||
(parent != null && parent instanceof MenuComponent &&
((MenuComponent)parent).newEventsOnly)) {
if (eventEnabled(e)) {
processEvent(e);
} else if (e instanceof ActionEvent && parent != null) {
e.setSource(parent);
((MenuComponent)parent).dispatchEvent(e);
}
} else { // backward compatibility
Event olde = e.convertToOld();
if (olde != null) {
postEvent(olde);
}
}
|
boolean | eventEnabled(java.awt.AWTEvent e)
return false;
|
int | getAccessibleChildIndex(java.awt.MenuComponent child)Gets the index of the child within this MenuComponent.
return -1; // Overridden in subclasses.
|
public 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.
return accessibleContext;
|
int | getAccessibleIndexInParent()Gets the index of this object in its accessible parent.
MenuContainer localParent = parent;
if (!(localParent instanceof MenuComponent)) {
// MenuComponents only have accessible index when inside MenuComponents
return -1;
}
MenuComponent localParentMenu = (MenuComponent)localParent;
return localParentMenu.getAccessibleChildIndex(this);
|
javax.accessibility.AccessibleStateSet | getAccessibleStateSet()Gets the state of this object.
AccessibleStateSet states = new AccessibleStateSet();
return states;
|
public java.awt.Font | getFont()Gets the font used for this menu component.
Font font = this.font;
if (font != null) {
return font;
}
MenuContainer parent = this.parent;
if (parent != null) {
return parent.getFont();
}
return null;
|
final java.awt.Font | getFont_NoClientCode()
Font font = this.font;
if (font != null) {
return font;
}
// The MenuContainer interface does not have getFont_NoClientCode()
// and it cannot, because it must be package-private. Because of
// this, we must manually cast classes that implement
// MenuContainer.
Object parent = this.parent;
if (parent != null) {
if (parent instanceof Component) {
font = ((Component)parent).getFont_NoClientCode();
} else if (parent instanceof MenuComponent) {
font = ((MenuComponent)parent).getFont_NoClientCode();
}
}
return font;
|
public java.lang.String | getName()Gets the name of the menu component.
if (name == null && !nameExplicitlySet) {
synchronized(this) {
if (name == null && !nameExplicitlySet)
name = constructComponentName();
}
}
return name;
|
public java.awt.MenuContainer | getParent()Returns the parent container for this menu component.
return getParent_NoClientCode();
|
final java.awt.MenuContainer | getParent_NoClientCode()
return parent;
|
public java.awt.peer.MenuComponentPeer | getPeer()
return peer;
|
protected final 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.
return Component.LOCK;
|
private static native void | initIDs()Initialize JNI field and method IDs.
|
protected 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 .
String thisName = getName();
return (thisName != null? thisName : "");
|
public boolean | postEvent(java.awt.Event evt)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.
MenuContainer parent = this.parent;
if (parent != null) {
parent.postEvent(evt);
}
return false;
|
protected void | processEvent(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.
|
private void | readObject(java.io.ObjectInputStream s)Reads the menu component from an object input stream.
GraphicsEnvironment.checkHeadless();
s.defaultReadObject();
privateKey = new Object();
appContext = AppContext.getAppContext();
|
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.
synchronized (getTreeLock()) {
MenuComponentPeer p = (MenuComponentPeer)this.peer;
if (p != null) {
Toolkit.getEventQueue().removeSourceEvents(this, true);
this.peer = null;
p.dispose();
}
}
|
public void | setFont(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.
font = f;
//Fixed 6312943: NullPointerException in method MenuComponent.setFont(Font)
MenuComponentPeer peer = (MenuComponentPeer)this.peer;
if (peer != null) {
peer.setFont(f);
}
|
public void | setName(java.lang.String name)Sets the name of the component to the specified string.
synchronized(this) {
this.name = name;
nameExplicitlySet = true;
}
|
public java.lang.String | toString()Returns a representation of this menu component as a string.
return getClass().getName() + "[" + paramString() + "]";
|