public class JPopupMenu extends JComponent implements Accessible, MenuElement
JPopupMenuは、メニュー・バー上の項目が選択されたときに表示するメニューに使用します。 また、選択したメニュー項目によっては表示されることもある、プルライト・メニューにも使用されます。 あるいは、メニューを表示するほかの場所(メニュー・バー以外の場所)でも、JPopupMenuを使用できます。 たとえば、特定の場所で右クリックが発生した場合のポップアップ・メニュー表示(ショートカット・メニュー)などです。 
 ポップアップ・メニューの使用方法の詳細と例については、「The Java Tutorial」の「How to Use Menus」を参照してください。
警告: Swingはスレッドに対して安全ではありません。 詳細は、「Swing's Threading Policy」を参照してください。
 警告: このクラスの直列化されたオブジェクトは、今後のSwingリリースと互換ではなくなる予定です。 現在の直列化のサポートは、短期間の格納や、同じバージョンのSwingを実行するアプリケーション間のRMIに適しています。 1.4以降、すべてのJavaBeans™用の長期間の格納サポートがjava.beansパッケージに追加されています。 XMLEncoderを参照してください。 
| 修飾子と型 | クラス | 説明 | 
|---|---|---|
protected class  | 
JPopupMenu.AccessibleJPopupMenu | 
 このクラスは 
JPopupMenuクラスのアクセシビリティ・サポートを実装しています。 | 
static class  | 
JPopupMenu.Separator | 
 ポップアップ・メニュー固有のセパレータです。 
 | 
JComponent.AccessibleJComponentContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategylistenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| コンストラクタ | 説明 | 
|---|---|
JPopupMenu() | 
 呼出しコンポーネントの定義なしで 
JPopupMenuを構築します。 | 
JPopupMenu(String label) | 
 指定されたタイトルを使用して 
JPopupMenuを構築します。 | 
| 修飾子と型 | メソッド | 説明 | 
|---|---|---|
JMenuItem | 
add(Action a) | 
 メニューの末尾に、指定された 
Actionオブジェクトをディスパッチするメニュー項目を追加します。 | 
JMenuItem | 
add(JMenuItem menuItem) | 
 指定されたメニュー項目をメニューの末尾に追加します。 
 | 
JMenuItem | 
add(String s) | 
 指定されたテキストを持つ新しいメニュー項目を作成して、このメニューの末尾に追加します。 
 | 
void | 
addMenuKeyListener(MenuKeyListener l) | 
 ポップアップ・メニューに 
MenuKeyListenerを追加します。 | 
void | 
addPopupMenuListener(PopupMenuListener l) | 
PopupMenuリスナーを追加します。 | 
void | 
addSeparator() | 
 メニューの末尾に新しいセパレータを追加します。 
 | 
protected PropertyChangeListener | 
createActionChangeListener(JMenuItem b) | 
Actionに対する変更が発生した場合にコントロールを更新する、適切に構成されたPropertyChangeListenerを返します。 | 
protected JMenuItem | 
createActionComponent(Action a) | 
JPopupMenuに追加されるActionsのJMenuItemを作成するファクトリ・メソッドです。 | 
protected void | 
firePopupMenuCanceled() | 
PopupMenuListenersに、このポップアップ・メニューが取り消されたことを通知します。 | 
protected void | 
firePopupMenuWillBecomeInvisible() | 
PopupMenuListenerに、このポップアップ・メニューが不可視になることを通知します。 | 
protected void | 
firePopupMenuWillBecomeVisible() | 
PopupMenuListenerに、このポップアップ・メニューが可視になることを通知します。 | 
AccessibleContext | 
getAccessibleContext() | 
 このJPopupMenuに関連付けられたAccessibleContextを取得します。 
 | 
Component | 
getComponent() | 
 この 
JPopupMenuコンポーネントを返します。 | 
Component | 
getComponentAtIndex(int i) | 
 非推奨。 
 
Container.getComponent(int)に置き換えられています | 
int | 
getComponentIndex(Component c) | 
 指定されたコンポーネントのインデックスを返します。 
 | 
static boolean | 
getDefaultLightWeightPopupEnabled() | 
defaultLightWeightPopupEnabledプロパティを取得します。デフォルトではtrueです。 | 
Component | 
getInvoker() | 
 このポップアップ・メニューの呼出し側であるコンポーネントを返します。 
 | 
String | 
getLabel() | 
 ポップアップ・メニューのラベルを返します。 
 | 
Insets | 
getMargin() | 
 ポップアップ・メニューのボーダーとコンテナの間にあるマージンを返します(ピクセル単位)。 
 | 
MenuKeyListener[] | 
getMenuKeyListeners() | 
 addMenuKeyListener()を使用してこのJPopupMenuに追加されたすべての 
MenuKeyListenerの配列を返します。 | 
PopupMenuListener[] | 
getPopupMenuListeners() | 
 addPopupMenuListener()を使用してこのJMenuItemに追加されたすべての 
PopupMenuListenerの配列を返します。 | 
SingleSelectionModel | 
getSelectionModel() | 
 単一の選択を扱うモデル・オブジェクトを返します。 
 | 
MenuElement[] | 
getSubElements() | 
 このメニュー・コンポーネントのサブメニューを格納する 
MenuElementの配列を返します。 | 
PopupMenuUI | 
getUI() | 
 このコンポーネントを描画するルック・アンド・フィール (L&F)オブジェクトを返します。 
 | 
String | 
getUIClassID() | 
 このコンポーネントを描画するL&Fクラスの名前を返します。 
 | 
void | 
insert(Action a, int index) | 
 指定された 
Actionオブジェクトを、メニュー項目として指定の位置に挿入します。 | 
void | 
insert(Component component, int index) | 
 指定されたコンポーネントを、メニューの指定された位置に挿入します。 
 | 
boolean | 
isBorderPainted() | 
 ボーダーをペイントするかどうかを調べます。 
 | 
boolean | 
isLightWeightPopupEnabled() | 
lightWeightPopupEnabledプロパティを取得します。 | 
boolean | 
isPopupTrigger(MouseEvent e) | 
JPopupMenuの現在インストールされているUIがMouseEventをポップアップ・トリガーと見なす場合は、trueを返します。 | 
boolean | 
isVisible() | 
 ポップアップ・メニューが可視(現在表示中)である場合にtrueを返します。 
 | 
void | 
menuSelectionChanged(boolean isIncluded) | 
 このメニューをアクティブにするか、アクティブではなくするためにメニュー・バーの選択が変更されたときに、メッセージを送ります。 
 | 
void | 
pack() | 
 コンテナをレイアウトして、内容の表示に最小限の空間を使用するようにします。 
 | 
protected void | 
paintBorder(Graphics g) | 
borderPaintedプロパティがtrueである場合に、ポップアップ・メニューのボーダーをペイントします。 | 
protected String | 
paramString() | 
 この 
JPopupMenuの文字列表現を返します。 | 
protected void | 
processFocusEvent(FocusEvent evt) | 
 このコンポーネントで発生するフォーカス・イベントを、登録されている 
FocusListenerオブジェクトにディスパッチすることによって処理します。 | 
protected void | 
processKeyEvent(KeyEvent evt) | 
 ニーモニックやアクセラレータなどの、キー・ストローク・イベントを処理します。 
 | 
void | 
processKeyEvent(KeyEvent e, MenuElement[] path, MenuSelectionManager manager) | 
MenuSelectionManagerから転送されるキー・イベントを処理し、必要に応じてMenuSelectionManagerのAPIを使用して、メニュー選択を変更します。 | 
void | 
processMouseEvent(MouseEvent event, MenuElement[] path, MenuSelectionManager manager) | 
 このメソッドは 
MenuElementインタフェースに適合するために必要ですが、実装されていません。 | 
void | 
remove(int pos) | 
 指定されたインデックスにあるコンポーネントをこのポップアップ・メニューから削除します。 
 | 
void | 
removeMenuKeyListener(MenuKeyListener l) | 
 ポップアップ・メニューから 
MenuKeyListenerを削除します。 | 
void | 
removePopupMenuListener(PopupMenuListener l) | 
PopupMenuリスナーを削除します。 | 
void | 
setBorderPainted(boolean b) | 
 ボーダーをペイントするかどうかを設定します。 
 | 
static void | 
setDefaultLightWeightPopupEnabled(boolean aFlag) | 
lightWeightPopupEnabledプロパティのデフォルト値を設定します。 | 
void | 
setInvoker(Component invoker) | 
 ポップアップ・メニューの呼出し側、すなわち、ポップアップ・メニュー項目が表示されるコンポーネントを設定します。 
 | 
void | 
setLabel(String label) | 
 ポップアップ・メニューのラベルを設定します。 
 | 
void | 
setLightWeightPopupEnabled(boolean aFlag) | 
lightWeightPopupEnabledプロパティの値を設定します。デフォルトではtrueです。 | 
void | 
setLocation(int x, int y) | 
 x、y座標を使って、ポップアップ・メニューの左上隅の位置を設定します。 
 | 
void | 
setPopupSize(Dimension d) | 
Dimensionオブジェクトを使用して、Popupウィンドウのサイズを設定します。 | 
void | 
setPopupSize(int width, int height) | 
 ポップアップ・ウィンドウのサイズを、指定された幅および高さに設定します。 
 | 
void | 
setSelected(Component sel) | 
 現在選択されるコンポーネントを設定します。結果として、選択モデルが変更されます。 
 | 
void | 
setSelectionModel(SingleSelectionModel model) | 
 単一の選択を扱うモデル・オブジェクトを設定します。 
 | 
void | 
setUI(PopupMenuUI ui) | 
 このコンポーネントを描画するL&Fオブジェクトを設定します。 
 | 
void | 
setVisible(boolean b) | 
 ポップアップ・メニューの可視性を設定します。 
 | 
void | 
show(Component invoker, int x, int y) | 
 呼出しコンポーネント内のx、y座標で指定された位置に、ポップアップ・メニューを表示します。 
 | 
void | 
updateUI() | 
 現在のルック・アンド・フィールからの値にUIプロパティをリセットします。 
 | 
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, updateadd, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCyclepublic JPopupMenu()
JPopupMenuを構築します。public JPopupMenu(String label)
JPopupMenuを構築します。label - ポップアップ・メニューのタイトルとしてUIが使用できる文字列。public static void setDefaultLightWeightPopupEnabled(boolean aFlag)
lightWeightPopupEnabledプロパティのデフォルト値を設定します。aFlag - ポップアップが軽量の場合はtrue、そうでない場合はfalsegetDefaultLightWeightPopupEnabled(), setLightWeightPopupEnabled(boolean)public static boolean getDefaultLightWeightPopupEnabled()
defaultLightWeightPopupEnabledプロパティを取得します。デフォルトではtrueです。defaultLightWeightPopupEnabledプロパティの値setDefaultLightWeightPopupEnabled(boolean)public PopupMenuUI getUI()
PopupMenuUIオブジェクトpublic void setUI(PopupMenuUI ui)
ui - 新規PopupMenuUI L&FオブジェクトUIDefaults.getUI(javax.swing.JComponent)public void updateUI()
updateUI、クラスJComponentJComponent.updateUI()public String getUIClassID()
getUIClassID、クラスJComponentJComponent.getUIClassID(), UIDefaults.getUI(javax.swing.JComponent)protected void processFocusEvent(FocusEvent evt)
ComponentFocusListenerオブジェクトにディスパッチすることによって処理します。
 このコンポーネントに対してフォーカス・イベントが使用可能でない場合、このメソッドは呼び出されません。 フォーカス・イベントは、次のいずれかの場合に使用可能になります。
FocusListenerオブジェクトがaddFocusListenerを使用して登録されている。
 enableEventsによってフォーカス・イベントが使用可能になっている。
 
 フォーカス・イベントがComponentに対して使用可能になっている場合、現在のKeyboardFocusManagerによって、登録されたFocusListenerオブジェクトにフォーカス・イベントをディスパッチする必要があるかどうかが判断されます。 イベントをディスパッチする場合、KeyboardFocusManagerはComponentのdispatchEventメソッドを呼び出すため、ComponentのprocessFocusEventメソッドが呼び出されます。 
 
 フォーカス・イベントがComponentに対して使用可能になっている場合、FocusEventを引数としてComponentのdispatchEventメソッドを呼び出すと、現在のKeyboardFocusManagerに関係なく、ComponentのprocessFocusEventメソッドが呼び出されます。
 
イベント・パラメータがnullである場合は、動作が未指定のため、例外が発生する可能性があります。
processFocusEvent、クラスComponentevt - フォーカス・イベントFocusEvent, FocusListener, KeyboardFocusManager, Component.addFocusListener(java.awt.event.FocusListener), Component.enableEvents(long), Component.dispatchEvent(java.awt.AWTEvent)protected void processKeyEvent(KeyEvent evt)
processKeyEvent、クラスJComponentevt - 処理されるキー・イベントKeyEvent, KeyListener, KeyboardFocusManager, DefaultKeyboardFocusManager, Component.processEvent(java.awt.AWTEvent), Component.dispatchEvent(java.awt.AWTEvent), Component.addKeyListener(java.awt.event.KeyListener), Component.enableEvents(long), Component.isShowing()public SingleSelectionModel getSelectionModel()
selectionModelプロパティSingleSelectionModelpublic void setSelectionModel(SingleSelectionModel model)
model - 新しいSingleSelectionModelSingleSelectionModelpublic JMenuItem add(JMenuItem menuItem)
menuItem - 追加するJMenuItemJMenuItempublic JMenuItem add(String s)
s - 追加されるメニュー項目の文字列public JMenuItem add(Action a)
Actionオブジェクトをディスパッチするメニュー項目を追加します。a - メニューに追加するActionActionprotected JMenuItem createActionComponent(Action a)
JPopupMenuに追加されるActionsのJMenuItemを作成するファクトリ・メソッドです。a - 追加されるメニュー項目のActionActionprotected PropertyChangeListener createActionChangeListener(JMenuItem b)
Actionに対する変更が発生した場合にコントロールを更新する、適切に構成されたPropertyChangeListenerを返します。public void remove(int pos)
remove、クラスContainerpos - 削除される項目の位置IllegalArgumentException - posの値が0より小さいか、posの値がメニュー項目の数より大きい場合Container.add(java.awt.Component), Container.invalidate(), Container.validate(), Container.getComponentCount()public void setLightWeightPopupEnabled(boolean aFlag)
lightWeightPopupEnabledプロパティの値を設定します。デフォルトではtrueです。 ルック・アンド・フィールがポップアップを表示するとき、デフォルトでは軽量(Java共通言語)ポップアップの使用を選択できます。 軽量ポップアップ・ウィンドウは重量(ネイティブ・ピア)ウィンドウよりも効率的ですが、軽量コンポーネントと重量コンポーネントはGUI内でうまく混在しません。 アプリケーションで軽量コンポーネントと重量コンポーネントが混在している場合は、軽量ポップアップを無効にする必要があります。 一部のルック・アンド・フィールでは、このプロパティの値に関係なく常に重量ポップアップが使用されることがあります。 aFlag - 軽量ポップアップを無効にする場合はfalseisLightWeightPopupEnabled()public boolean isLightWeightPopupEnabled()
lightWeightPopupEnabledプロパティを取得します。lightWeightPopupEnabledプロパティの値setLightWeightPopupEnabled(boolean)public String getLabel()
setLabel(java.lang.String)public void setLabel(String label)
label - ポップアップ・メニューのラベルを指定する文字列setLabel(java.lang.String)public void addSeparator()
public void insert(Action a, int index)
Actionオブジェクトを、メニュー項目として指定の位置に挿入します。a - 挿入するActionオブジェクトindex - Actionを挿入する位置。0はメニューの先頭IllegalArgumentException - indexが0未満の場合Actionpublic void insert(Component component, int index)
component - 挿入するComponentindex - コンポーネントを挿入する位置。0はメニューの先頭IllegalArgumentException - indexが0未満の場合public void addPopupMenuListener(PopupMenuListener l)
PopupMenuリスナーを追加します。l - 追加するPopupMenuListenerpublic void removePopupMenuListener(PopupMenuListener l)
PopupMenuリスナーを削除します。l - 削除するPopupMenuListenerpublic PopupMenuListener[] getPopupMenuListeners()
PopupMenuListenerの配列を返します。PopupMenuListener。リスナーが追加されていない場合は空の配列public void addMenuKeyListener(MenuKeyListener l)
MenuKeyListenerを追加します。l - 追加されるMenuKeyListenerpublic void removeMenuKeyListener(MenuKeyListener l)
MenuKeyListenerを削除します。l - 削除するMenuKeyListenerpublic MenuKeyListener[] getMenuKeyListeners()
MenuKeyListenerの配列を返します。MenuKeyListener。リスナーが追加されていない場合は空の配列protected void firePopupMenuWillBecomeVisible()
PopupMenuListenerに、このポップアップ・メニューが可視になることを通知します。protected void firePopupMenuWillBecomeInvisible()
PopupMenuListenerに、このポップアップ・メニューが不可視になることを通知します。protected void firePopupMenuCanceled()
PopupMenuListenersに、このポップアップ・メニューが取り消されたことを通知します。public void pack()
public void setVisible(boolean b)
setVisible、クラスJComponentb - ポップアップを可視にする場合はtrue、隠す場合はfalseComponent.isVisible(), Component.invalidate()public boolean isVisible()
isVisible、クラスComponenttrue、そうでない場合はfalseComponent.setVisible(boolean)public void setLocation(int x,
                        int y)
 このメソッドは、幾何学的図形に関連するデータを変更します。 そのため、JPopupMenuオブジェクトがデスクトップ設定に厳密に対応する方法で配置およびサイズ設定されるように、ネイティブ・ウィンドウ管理システムはこのような要求を無視するか、または要求されたデータを変更する可能性があります。 
setLocation、クラスComponentx - 画面の座標空間でのポップアップ・メニューの新しい位置のx座標y - 画面の座標空間でのポップアップ・メニューの新しい位置のy座標Component.getLocation(), Component.setBounds(int, int, int, int), Component.invalidate()public Component getInvoker()
Componentpublic void setInvoker(Component invoker)
invoker - ポップアップ・メニューが表示されるComponentpublic void show(Component invoker, int x, int y)
invoker - ポップアップ・メニューが表示されるコンポーネントx - ポップアップ・メニューを表示する呼出しコンポーネントの座標空間でのx座標y - ポップアップ・メニューを表示する呼出しコンポーネントの座標空間でのy座標@Deprecated public Component getComponentAtIndex(int i)
Container.getComponent(int)に置き換えられていますi - コンポーネントのインデックス。0が先頭Componentpublic int getComponentIndex(Component c)
c - 検索対象のComponentpublic void setPopupSize(Dimension d)
Dimensionオブジェクトを使用して、Popupウィンドウのサイズを設定します。 これは、setPreferredSize(d)と同等です。 d - このコンポーネントの新規サイズを指定するDimension。public void setPopupSize(int width,
                         int height)
setPreferredSize(new Dimension(width, height))と同等です。 width - Popupの新しい幅(ピクセル単位)height - Popupの新しい高さ(ピクセル単位)public void setSelected(Component sel)
sel - 選択するComponentpublic boolean isBorderPainted()
setBorderPainted(boolean)public void setBorderPainted(boolean b)
b - trueの場合はボーダーがペイントされる。isBorderPainted()protected void paintBorder(Graphics g)
borderPaintedプロパティがtrueである場合に、ポップアップ・メニューのボーダーをペイントします。paintBorder、クラスJComponentg - GraphicsオブジェクトJComponent.paint(java.awt.Graphics), JComponent.setBorder(javax.swing.border.Border)public Insets getMargin()
Insetsオブジェクト。protected String paramString()
JPopupMenuの文字列表現を返します。 このメソッドはデバッグ専用であり、返される文字列の内容および形式は実装によって異なります。 返される文字列は空の場合がありますが、nullにはなりません。 paramString、クラスJComponentJPopupMenuを表す文字列表現。public AccessibleContext getAccessibleContext()
getAccessibleContext、インタフェースAccessiblegetAccessibleContext、クラスComponentpublic void processMouseEvent(MouseEvent event, MenuElement[] path, MenuSelectionManager manager)
MenuElementインタフェースに適合するために必要ですが、実装されていません。public void processKeyEvent(KeyEvent e, MenuElement[] path, MenuSelectionManager manager)
MenuSelectionManagerから転送されるキー・イベントを処理し、必要に応じてMenuSelectionManagerのAPIを使用して、メニュー選択を変更します。
 
 ノート: イベントをサブコンポーネントに転送する必要はありません。 MenuSelectionManagerが自動的に行います。 
processKeyEvent、インタフェースMenuElemente - aKeyEventpath - MenuElementパス配列manager - MenuSelectionManagerpublic void menuSelectionChanged(boolean isIncluded)
javax.swing.MenuElementインタフェースを実装します。 MenuElement.menuSelectionChangedをオーバーライドします。 menuSelectionChanged、インタフェースMenuElementisIncluded - このメニューがアクティブな場合はtrue、そうでない場合はfalseMenuElement.menuSelectionChanged(boolean)public MenuElement[] getSubElements()
MenuElementの配列を返します。 JMenuElementインタフェースに適合する項目だけを返します。 ポップアップ・メニューがnullの場合は空の配列を返します。 このメソッドは、MenuElementインタフェースに適合するために必要です。 getSubElements、インタフェースMenuElementMenuElementオブジェクトの配列MenuElement.getSubElements()public Component getComponent()
JPopupMenuコンポーネントを返します。getComponent、インタフェースMenuElementJPopupMenuオブジェクトMenuElement.getComponent()public boolean isPopupTrigger(MouseEvent e)
JPopupMenuの現在インストールされているUIがMouseEventをポップアップ・トリガーと見なす場合は、trueを返します。 バグまたは機能を送信 
詳細なAPIリファレンスおよび開発者ドキュメントについては、Java SEのドキュメントを参照してください。 そのドキュメントには、概念的な概要、用語の定義、回避方法、有効なコード例などの、開発者を対象にしたより詳細な説明が含まれています。 
 Copyright © 1993, 2025, Oracle and/or its affiliates.  All rights reserved.  Use is subject to license terms.  Documentation Redistribution Policyも参照してください。