public class PopupMenu extends Menu
作为继承层次结构意味着,一个PopupMenu到处都可以用一个Menu可。然而,如果你使用一个PopupMenu像Menu(例如,将它添加到MenuBar),那么你不能呼吁PopupMenu show。
| Modifier and Type | Class and Description |
|---|---|
protected class |
PopupMenu.AccessibleAWTPopupMenu
用于提供访问默认支持页的内部类。
|
Menu.AccessibleAWTMenuMenuItem.AccessibleAWTMenuItemMenuComponent.AccessibleAWTMenuComponent| Constructor and Description |
|---|
PopupMenu()
创建一个新的名称为空的弹出式菜单。
|
PopupMenu(String label)
创建一个新的具有指定名称的弹出式菜单。
|
| Modifier and Type | Method and Description |
|---|---|
void |
addNotify()
创建弹出式菜单的同伴。
|
AccessibleContext |
getAccessibleContext()
获取与此相关的
AccessibleContext
PopupMenu。
|
MenuContainer |
getParent()
返回此菜单组件的父容器。
|
void |
show(Component origin, int x, int y)
显示在X的弹出菜单,Y位置相对于来源成分。
|
add, add, addSeparator, countItems, getItem, getItemCount, insert, insert, insertSeparator, isTearOff, paramString, remove, remove, removeAll, removeNotifyaddActionListener, deleteShortcut, disable, disableEvents, enable, enable, enableEvents, getActionCommand, getActionListeners, getLabel, getListeners, getShortcut, isEnabled, processActionEvent, processEvent, removeActionListener, setActionCommand, setEnabled, setLabel, setShortcutdispatchEvent, getFont, getName, getPeer, getTreeLock, postEvent, setFont, setName, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetFont, postEventpublic PopupMenu()
throws HeadlessException
HeadlessException -如果graphicsenvironment isheadless()返回true。
GraphicsEnvironment.isHeadless()
public PopupMenu(String label) throws HeadlessException
label - non-
null字符串指定弹出式菜单的标签
HeadlessException -如果graphicsenvironment isheadless()返回true。
GraphicsEnvironment.isHeadless()
public MenuContainer getParent()
getParent 方法重写,继承类
MenuComponent
null如果这个菜单组件的最外层部分,菜单栏本身
public void addNotify()
public void show(Component origin, int x, int y)
如果这PopupMenu作为Menu(即,它有一个non-Component母),则不能调用此方法在PopupMenu。
origin -定义坐标空间的组成部分
x的x坐标位置弹出菜单
y - Y坐标位置弹出菜单
NullPointerException -如果家长
null
IllegalArgumentException -如果这
PopupMenu有non-
Component母
IllegalArgumentException如果产地不在父母的层次
RuntimeException -如果家长不显示在屏幕上
public AccessibleContext getAccessibleContext()
AccessibleContext
PopupMenu。
getAccessibleContext 接口
Accessible
getAccessibleContext 方法重写,继承类
Menu
PopupMenu的
AccessibleContext
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.