- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPopupMenu
-
- すべての実装されたインタフェース:
ImageObserver,MenuContainer,Serializable,Accessible,MenuElement
- 直系の既知のサブクラス:
BasicComboPopup
@JavaBean(defaultProperty="UI", description="A small window that pops up and displays a series of choices.") 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を参照してください。- 導入されたバージョン:
- 1.2
- 関連項目:
- 直列化された形式
-
-
ネストされたクラスのサマリー
ネストされたクラス 修飾子と型 クラス 説明 protected classJPopupMenu.AccessibleJPopupMenuこのクラスはJPopupMenuクラスのアクセシビリティ・サポートを実装しています。static classJPopupMenu.Separatorポップアップ・メニュー固有のセパレータです。-
クラス java.awt.Componentで宣言されたネストされたクラス/インタフェース
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
クラス java.awt.Containerで宣言されたネストされたクラス/インタフェース
Container.AccessibleAWTContainer
-
クラス javax.swing.JComponentで宣言されたネストされたクラス/インタフェース
JComponent.AccessibleJComponent
-
-
フィールドのサマリー
-
クラス java.awt.Componentで宣言されたフィールド
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
インタフェース java.awt.image.ImageObserverで宣言されたフィールド
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
クラス javax.swing.JComponentで宣言されたフィールド
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
-
コンストラクタのサマリー
コンストラクタ コンストラクタ 説明 JPopupMenu()呼出しコンポーネントの定義なしでJPopupMenuを構築します。JPopupMenu(String label)指定されたタイトルを使用してJPopupMenuを構築します。
-
メソッドのサマリー
すべてのメソッド staticメソッド インスタンス・メソッド 具象メソッド 非推奨のメソッド 修飾子と型 メソッド 説明 JMenuItemadd(String s)指定されたテキストを持つ新しいメニュー項目を作成して、このメニューの末尾に追加します。JMenuItemadd(Action a)メニューの末尾に、指定されたActionオブジェクトをディスパッチするメニュー項目を追加します。JMenuItemadd(JMenuItem menuItem)指定されたメニュー項目をメニューの末尾に追加します。voidaddMenuKeyListener(MenuKeyListener l)ポップアップ・メニューにMenuKeyListenerを追加します。voidaddPopupMenuListener(PopupMenuListener l)PopupMenuリスナーを追加します。voidaddSeparator()メニューの末尾に新しいセパレータを追加します。protected PropertyChangeListenercreateActionChangeListener(JMenuItem b)Actionに対する変更が発生した場合にコントロールを更新する、適切に構成されたPropertyChangeListenerを返します。protected JMenuItemcreateActionComponent(Action a)JPopupMenuに追加されるActionsのJMenuItemを作成するファクトリ・メソッドです。protected voidfirePopupMenuCanceled()PopupMenuListenersに、このポップアップ・メニューが取り消されたことを通知します。protected voidfirePopupMenuWillBecomeInvisible()PopupMenuListenerに、このポップアップ・メニューが不可視になることを通知します。protected voidfirePopupMenuWillBecomeVisible()PopupMenuListenerに、このポップアップ・メニューが可視になることを通知します。AccessibleContextgetAccessibleContext()このJPopupMenuに関連付けられたAccessibleContextを取得します。ComponentgetComponent()このJPopupMenuコンポーネントを返します。ComponentgetComponentAtIndex(int i)非推奨。Container.getComponent(int)に置き換えられていますintgetComponentIndex(Component c)指定されたコンポーネントのインデックスを返します。static booleangetDefaultLightWeightPopupEnabled()defaultLightWeightPopupEnabledプロパティを取得します。デフォルトではtrueです。ComponentgetInvoker()このポップアップ・メニューの呼出し側であるコンポーネントを返します。StringgetLabel()ポップアップ・メニューのラベルを返します。InsetsgetMargin()ポップアップ・メニューのボーダーとコンテナの間にあるマージンを返します(ピクセル単位)。MenuKeyListener[]getMenuKeyListeners()addMenuKeyListener()を使用してこのJPopupMenuに追加されたすべてのMenuKeyListenerの配列を返します。PopupMenuListener[]getPopupMenuListeners()addPopupMenuListener()を使用してこのJMenuItemに追加されたすべてのPopupMenuListenerの配列を返します。SingleSelectionModelgetSelectionModel()単一の選択を扱うモデル・オブジェクトを返します。MenuElement[]getSubElements()このメニュー・コンポーネントのサブメニューを格納するMenuElementの配列を返します。PopupMenuUIgetUI()このコンポーネントを描画するLook & Feel (L&F)オブジェクトを返します。StringgetUIClassID()このコンポーネントを描画するL&Fクラスの名前を返します。voidinsert(Component component, int index)指定されたコンポーネントを、メニューの指定された位置に挿入します。voidinsert(Action a, int index)指定されたActionオブジェクトを、メニュー項目として指定の位置に挿入します。booleanisBorderPainted()ボーダーをペイントするかどうかを調べます。booleanisLightWeightPopupEnabled()lightWeightPopupEnabledプロパティを取得します。booleanisPopupTrigger(MouseEvent e)JPopupMenuの現在インストールされているUIがMouseEventをポップアップ・トリガーと見なす場合は、trueを返します。booleanisVisible()ポップアップ・メニューが可視(現在表示中)である場合にtrueを返します。voidmenuSelectionChanged(boolean isIncluded)このメニューをアクティブにするか、アクティブではなくするためにメニュー・バーの選択が変更されたときに、メッセージを送ります。voidpack()コンテナをレイアウトして、内容の表示に最小限の空間を使用するようにします。protected voidpaintBorder(Graphics g)borderPaintedプロパティがtrueである場合に、ポップアップ・メニューのボーダーをペイントします。protected StringparamString()このJPopupMenuの文字列表現を返します。protected voidprocessKeyEvent(KeyEvent evt)ニーモニックやアクセラレータなどの、キー・ストローク・イベントを処理します。voidprocessKeyEvent(KeyEvent e, MenuElement[] path, MenuSelectionManager manager)MenuSelectionManagerから転送されるキー・イベントを処理し、必要に応じてMenuSelectionManagerのAPIを使用して、メニュー選択を変更します。voidprocessMouseEvent(MouseEvent event, MenuElement[] path, MenuSelectionManager manager)このメソッドはMenuElementインタフェースに適合するために必要ですが、実装されていません。voidremove(int pos)指定されたインデックスにあるコンポーネントをこのポップアップ・メニューから削除します。voidremoveMenuKeyListener(MenuKeyListener l)ポップアップ・メニューからMenuKeyListenerを削除します。voidremovePopupMenuListener(PopupMenuListener l)PopupMenuリスナーを削除します。voidsetBorderPainted(boolean b)ボーダーをペイントするかどうかを設定します。static voidsetDefaultLightWeightPopupEnabled(boolean aFlag)lightWeightPopupEnabledプロパティのデフォルト値を設定します。voidsetInvoker(Component invoker)ポップアップ・メニューの呼出し側、すなわち、ポップアップ・メニュー項目が表示されるコンポーネントを設定します。voidsetLabel(String label)ポップアップ・メニューのラベルを設定します。voidsetLightWeightPopupEnabled(boolean aFlag)lightWeightPopupEnabledプロパティの値を設定します。デフォルトではtrueです。voidsetLocation(int x, int y)x、y座標を使って、ポップアップ・メニューの左上隅の位置を設定します。voidsetPopupSize(int width, int height)ポップアップ・ウィンドウのサイズを、指定された幅および高さに設定します。voidsetPopupSize(Dimension d)Dimensionオブジェクトを使用して、Popupウィンドウのサイズを設定します。voidsetSelected(Component sel)現在選択されるコンポーネントを設定します。結果として、選択モデルが変更されます。voidsetSelectionModel(SingleSelectionModel model)単一の選択を扱うモデル・オブジェクトを設定します。voidsetUI(PopupMenuUI ui)このコンポーネントを描画するL&Fオブジェクトを設定します。voidsetVisible(boolean b)ポップアップ・メニューの可視性を設定します。voidshow(Component invoker, int x, int y)呼出しコンポーネント内のx、y座標で指定された位置に、ポップアップ・メニューを表示します。voidupdateUI()現在のLook & Feelからの値にUIプロパティをリセットします。-
クラス java.awt.Componentで宣言されたメソッド
action, 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, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
クラス java.awt.Containerで宣言されたメソッド
add, 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, validateTree
-
クラス javax.swing.JComponentで宣言されたメソッド
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, 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, 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, update
-
-
-
-
コンストラクタの詳細
-
JPopupMenu
public JPopupMenu()
呼出しコンポーネントの定義なしでJPopupMenuを構築します。
-
JPopupMenu
public JPopupMenu(String label)
指定されたタイトルを使用してJPopupMenuを構築します。- パラメータ:
label- ポップアップ・メニューのタイトルとしてUIが使用できる文字列。
-
-
メソッドの詳細
-
setDefaultLightWeightPopupEnabled
public static void setDefaultLightWeightPopupEnabled(boolean aFlag)
lightWeightPopupEnabledプロパティのデフォルト値を設定します。- パラメータ:
aFlag- ポップアップが軽量の場合はtrue、そうでない場合はfalse- 関連項目:
getDefaultLightWeightPopupEnabled(),setLightWeightPopupEnabled(boolean)
-
getDefaultLightWeightPopupEnabled
public static boolean getDefaultLightWeightPopupEnabled()
defaultLightWeightPopupEnabledプロパティを取得します。デフォルトではtrueです。- 戻り値:
defaultLightWeightPopupEnabledプロパティの値- 関連項目:
setDefaultLightWeightPopupEnabled(boolean)
-
getUI
public PopupMenuUI getUI()
このコンポーネントを描画するLook & Feel (L&F)オブジェクトを返します。- オーバーライド:
- クラス
JComponentのgetUI - 戻り値:
- このコンポーネントをレンダリングする
PopupMenuUIオブジェクト
-
setUI
@BeanProperty(hidden=true, visualUpdate=true, description="The UI object that implements the Component\'s LookAndFeel.") public void setUI(PopupMenuUI ui)
このコンポーネントを描画するL&Fオブジェクトを設定します。- パラメータ:
ui- 新規PopupMenuUIL&Fオブジェクト- 関連項目:
UIDefaults.getUI(javax.swing.JComponent)
-
updateUI
public void updateUI()
現在のLook & Feelからの値にUIプロパティをリセットします。- オーバーライド:
updateUI、クラス:JComponent- 関連項目:
JComponent.updateUI()
-
getUIClassID
@BeanProperty(bound=false) public String getUIClassID()
このコンポーネントを描画するL&Fクラスの名前を返します。- オーバーライド:
getUIClassID、クラス:JComponent- 戻り値:
- 文字列「PopupMenuUI」
- 関連項目:
JComponent.getUIClassID(),UIDefaults.getUI(javax.swing.JComponent)
-
processKeyEvent
protected void processKeyEvent(KeyEvent evt)
ニーモニックやアクセラレータなどの、キー・ストローク・イベントを処理します。- オーバーライド:
processKeyEvent、クラス:JComponent- パラメータ:
evt- 処理されるキー・イベント- 関連項目:
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()
-
getSelectionModel
public SingleSelectionModel getSelectionModel()
単一の選択を扱うモデル・オブジェクトを返します。- 戻り値:
selectionModelプロパティ- 関連項目:
SingleSelectionModel
-
setSelectionModel
@BeanProperty(bound=false, expert=true, description="The selection model for the popup menu") public void setSelectionModel(SingleSelectionModel model)
単一の選択を扱うモデル・オブジェクトを設定します。- パラメータ:
model- 新しいSingleSelectionModel- 関連項目:
SingleSelectionModel
-
add
public JMenuItem add(JMenuItem menuItem)
指定されたメニュー項目をメニューの末尾に追加します。- パラメータ:
menuItem- 追加するJMenuItem- 戻り値:
- 追加された
JMenuItem
-
add
public JMenuItem add(String s)
指定されたテキストを持つ新しいメニュー項目を作成して、このメニューの末尾に追加します。- パラメータ:
s- 追加されるメニュー項目の文字列- 戻り値:
sを使用して作成された新しいJMenuItem
-
add
public JMenuItem add(Action a)
メニューの末尾に、指定されたActionオブジェクトをディスパッチするメニュー項目を追加します。- パラメータ:
a- メニューに追加するAction- 戻り値:
- 新しいメニュー項目
- 関連項目:
Action
-
createActionComponent
protected JMenuItem createActionComponent(Action a)
JPopupMenuに追加されるActionsのJMenuItemを作成するファクトリ・メソッドです。- パラメータ:
a- 追加されるメニュー項目のAction- 戻り値:
- 新しいメニュー項目
- 導入されたバージョン:
- 1.3
- 関連項目:
Action
-
createActionChangeListener
protected PropertyChangeListener createActionChangeListener(JMenuItem b)
Actionに対する変更が発生した場合にコントロールを更新する、適切に構成されたPropertyChangeListenerを返します。- パラメータ:
b- リスナーを作成するメニュー・アイテム- 戻り値:
- 適切に構成された
PropertyChangeListener
-
remove
public void remove(int pos)
指定されたインデックスにあるコンポーネントをこのポップアップ・メニューから削除します。- オーバーライド:
remove、クラス:Container- パラメータ:
pos- 削除される項目の位置- 例外:
IllegalArgumentException-posの値が0より小さいか、posの値がメニュー項目の数より大きい場合- 関連項目:
Container.add(java.awt.Component),Container.invalidate(),Container.validate(),Container.getComponentCount()
-
setLightWeightPopupEnabled
@BeanProperty(bound=false, expert=true, description="Determines whether lightweight popups are used when possible") public void setLightWeightPopupEnabled(boolean aFlag)
lightWeightPopupEnabledプロパティの値を設定します。デフォルトではtrueです。 Look & Feelがポップアップを表示するとき、デフォルトでは軽量(Java共通言語)ポップアップの使用を選択できます。 軽量ポップアップ・ウィンドウは重量(ネイティブ・ピア)ウィンドウよりも効率的ですが、軽量コンポーネントと重量コンポーネントはGUI内でうまく混在しません。 アプリケーションで軽量コンポーネントと重量コンポーネントが混在している場合は、軽量ポップアップを無効にする必要があります。 一部のLook & Feelでは、このプロパティの値に関係なく常に重量ポップアップが使用されることがあります。- パラメータ:
aFlag- 軽量ポップアップを無効にする場合はfalse- 関連項目:
isLightWeightPopupEnabled()
-
isLightWeightPopupEnabled
public boolean isLightWeightPopupEnabled()
lightWeightPopupEnabledプロパティを取得します。- 戻り値:
lightWeightPopupEnabledプロパティの値- 関連項目:
setLightWeightPopupEnabled(boolean)
-
getLabel
public String getLabel()
ポップアップ・メニューのラベルを返します。- 戻り値:
- ポップアップ・メニューのラベルが格納されている文字列
- 関連項目:
setLabel(java.lang.String)
-
setLabel
@BeanProperty(description="The label for the popup menu.") public void setLabel(String label)
ポップアップ・メニューのラベルを設定します。 Look & Feelの実装ごとに、ラベルを表示するかどうかを選択してもかまいません。- パラメータ:
label- ポップアップ・メニューのラベルを指定する文字列- 関連項目:
setLabel(java.lang.String)
-
addSeparator
public void addSeparator()
メニューの末尾に新しいセパレータを追加します。
-
insert
public void insert(Action a, int index)
指定されたActionオブジェクトを、メニュー項目として指定の位置に挿入します。- パラメータ:
a- 挿入するActionオブジェクトindex-Actionを挿入する位置。0はメニューの先頭- 例外:
IllegalArgumentException-indexが0未満の場合- 関連項目:
Action
-
insert
public void insert(Component component, int index)
指定されたコンポーネントを、メニューの指定された位置に挿入します。- パラメータ:
component- 挿入するComponentindex- コンポーネントを挿入する位置。0はメニューの先頭- 例外:
IllegalArgumentException-indexが0未満の場合
-
addPopupMenuListener
public void addPopupMenuListener(PopupMenuListener l)
PopupMenuリスナーを追加します。- パラメータ:
l- 追加するPopupMenuListener
-
removePopupMenuListener
public void removePopupMenuListener(PopupMenuListener l)
PopupMenuリスナーを削除します。- パラメータ:
l- 削除するPopupMenuListener
-
getPopupMenuListeners
@BeanProperty(bound=false) public PopupMenuListener[] getPopupMenuListeners()
addPopupMenuListener()を使用してこのJMenuItemに追加されたすべてのPopupMenuListenerの配列を返します。- 戻り値:
- 追加されたすべての
PopupMenuListener。リスナーが追加されていない場合は空の配列 - 導入されたバージョン:
- 1.4
-
addMenuKeyListener
public void addMenuKeyListener(MenuKeyListener l)
ポップアップ・メニューにMenuKeyListenerを追加します。- パラメータ:
l- 追加されるMenuKeyListener- 導入されたバージョン:
- 1.5
-
removeMenuKeyListener
public void removeMenuKeyListener(MenuKeyListener l)
ポップアップ・メニューからMenuKeyListenerを削除します。- パラメータ:
l- 削除するMenuKeyListener- 導入されたバージョン:
- 1.5
-
getMenuKeyListeners
@BeanProperty(bound=false) public MenuKeyListener[] getMenuKeyListeners()
addMenuKeyListener()を使用してこのJPopupMenuに追加されたすべてのMenuKeyListenerの配列を返します。- 戻り値:
- 追加されたすべての
MenuKeyListener。リスナーが追加されていない場合は空の配列 - 導入されたバージョン:
- 1.5
-
firePopupMenuWillBecomeVisible
protected void firePopupMenuWillBecomeVisible()
PopupMenuListenerに、このポップアップ・メニューが可視になることを通知します。
-
firePopupMenuWillBecomeInvisible
protected void firePopupMenuWillBecomeInvisible()
PopupMenuListenerに、このポップアップ・メニューが不可視になることを通知します。
-
firePopupMenuCanceled
protected void firePopupMenuCanceled()
PopupMenuListenersに、このポップアップ・メニューが取り消されたことを通知します。
-
pack
public void pack()
コンテナをレイアウトして、内容の表示に最小限の空間を使用するようにします。
-
setVisible
@BeanProperty(description="Makes the popup visible") public void setVisible(boolean b)
ポップアップ・メニューの可視性を設定します。- オーバーライド:
setVisible、クラス:JComponent- パラメータ:
b- ポップアップを可視にする場合はtrue、隠す場合はfalse- 関連項目:
Component.isVisible(),Component.invalidate()
-
isVisible
public boolean isVisible()
ポップアップ・メニューが可視(現在表示中)である場合にtrueを返します。- オーバーライド:
isVisible、クラス:Component- 戻り値:
- コンポーネントが可視の場合は
true、そうでない場合はfalse - 関連項目:
Component.setVisible(boolean)
-
setLocation
@BeanProperty(description="The location of the popup menu.") public void setLocation(int x, int y)
x、y座標を使って、ポップアップ・メニューの左上隅の位置を設定します。このメソッドは、幾何学的図形に関連するデータを変更します。 そのため、
JPopupMenuオブジェクトがデスクトップ設定に厳密に対応する方法で配置およびサイズ設定されるように、ネイティブ・ウィンドウ管理システムはこのような要求を無視するか、または要求されたデータを変更する可能性があります。- オーバーライド:
setLocation、クラス:Component- パラメータ:
x- 画面の座標空間でのポップアップ・メニューの新しい位置のx座標y- 画面の座標空間でのポップアップ・メニューの新しい位置のy座標- 関連項目:
Component.getLocation(),Component.setBounds(int, int, int, int),Component.invalidate()
-
getInvoker
public Component getInvoker()
このポップアップ・メニューの呼出し側であるコンポーネントを返します。- 戻り値:
- ポップアップ・メニューが表示される
Component
-
setInvoker
@BeanProperty(bound=false, expert=true, description="The invoking component for the popup menu") public void setInvoker(Component invoker)
ポップアップ・メニューの呼出し側、すなわち、ポップアップ・メニュー項目が表示されるコンポーネントを設定します。- パラメータ:
invoker- ポップアップ・メニューが表示されるComponent
-
show
public void show(Component invoker, int x, int y)
呼出しコンポーネント内のx、y座標で指定された位置に、ポップアップ・メニューを表示します。- パラメータ:
invoker- ポップアップ・メニューが表示されるコンポーネントx- ポップアップ・メニューを表示する呼出しコンポーネントの座標空間でのx座標y- ポップアップ・メニューを表示する呼出しコンポーネントの座標空間でのy座標
-
getComponentAtIndex
@Deprecated public Component getComponentAtIndex(int i)
非推奨。Container.getComponent(int)に置き換えられています指定されたインデックスの要素を返します。- パラメータ:
i- コンポーネントのインデックス。0が先頭- 戻り値:
- 指定されたインデックスの
Component
-
getComponentIndex
public int getComponentIndex(Component c)
指定されたコンポーネントのインデックスを返します。- パラメータ:
c- 検索対象のComponent- 戻り値:
- コンポーネントのインデックス。0が先頭。コンポーネントがなければ -1
-
setPopupSize
@BeanProperty(description="The size of the popup menu") public void setPopupSize(Dimension d)
Dimensionオブジェクトを使用して、Popupウィンドウのサイズを設定します。 これは、setPreferredSize(d)と同等です。- パラメータ:
d- このコンポーネントの新規サイズを指定するDimension。
-
setPopupSize
@BeanProperty(description="The size of the popup menu") public void setPopupSize(int width, int height)
ポップアップ・ウィンドウのサイズを、指定された幅および高さに設定します。 これは、setPreferredSize(new Dimension(width, height))と同等です。- パラメータ:
width- Popupの新しい幅(ピクセル単位)height- Popupの新しい高さ(ピクセル単位)
-
setSelected
@BeanProperty(expert=true, hidden=true, description="The selected component on the popup menu") public void setSelected(Component sel)
現在選択されるコンポーネントを設定します。結果として、選択モデルが変更されます。- パラメータ:
sel- 選択するComponent
-
isBorderPainted
public boolean isBorderPainted()
ボーダーをペイントするかどうかを調べます。- 戻り値:
- ボーダーをペイントする場合はtrue、そうでない場合はfalse
- 関連項目:
setBorderPainted(boolean)
-
setBorderPainted
@BeanProperty(bound=false, description="Is the border of the popup menu painted") public void setBorderPainted(boolean b)
ボーダーをペイントするかどうかを設定します。- パラメータ:
b- trueの場合はボーダーがペイントされる。- 関連項目:
isBorderPainted()
-
paintBorder
protected void paintBorder(Graphics g)
borderPaintedプロパティがtrueである場合に、ポップアップ・メニューのボーダーをペイントします。- オーバーライド:
paintBorder、クラス:JComponent- パラメータ:
g-Graphicsオブジェクト- 関連項目:
JComponent.paint(java.awt.Graphics),JComponent.setBorder(javax.swing.border.Border)
-
getMargin
@BeanProperty(bound=false) public Insets getMargin()
ポップアップ・メニューのボーダーとコンテナの間にあるマージンを返します(ピクセル単位)。- 戻り値:
- マージン値を保持する
Insetsオブジェクト。
-
paramString
protected String paramString()
このJPopupMenuの文字列表現を返します。 このメソッドはデバッグ専用であり、返される文字列の内容および形式は実装によって異なります。 返される文字列は空の場合がありますが、nullにはなりません。- オーバーライド:
paramString、クラス:JComponent- 戻り値:
- この
JPopupMenuを表す文字列表現。
-
getAccessibleContext
@BeanProperty(bound=false) public AccessibleContext getAccessibleContext()
このJPopupMenuに関連付けられたAccessibleContextを取得します。 JPopupMenuの場合、AccessibleContextはAccessibleJPopupMenuの形式を取ります。 必要に応じて新規のAccessibleJPopupMenuインスタンスが作成されます。- 定義:
getAccessibleContext、インタフェース:Accessible- オーバーライド:
getAccessibleContext、クラス:Component- 戻り値:
- このJPopupMenuのAccessibleContextとして機能するAccessibleJPopupMenu
-
processMouseEvent
public void processMouseEvent(MouseEvent event, MenuElement[] path, MenuSelectionManager manager)
このメソッドはMenuElementインタフェースに適合するために必要ですが、実装されていません。- 定義:
processMouseEvent、インタフェース:MenuElement- パラメータ:
event- 処理されるMouseEventpath- メニュー階層内の受信要素のパスmanager- メニュー階層のMenuSelectionManager- 関連項目:
MenuElement.processMouseEvent(MouseEvent, MenuElement[], MenuSelectionManager)
-
processKeyEvent
public void processKeyEvent(KeyEvent e, MenuElement[] path, MenuSelectionManager manager)
MenuSelectionManagerから転送されるキー・イベントを処理し、必要に応じてMenuSelectionManagerのAPIを使用して、メニュー選択を変更します。注: イベントをサブコンポーネントに転送する必要はありません。
MenuSelectionManagerが自動的に行います。- 定義:
processKeyEvent、インタフェース:MenuElement- パラメータ:
e- aKeyEventpath-MenuElementパス配列manager-MenuSelectionManager
-
menuSelectionChanged
public void menuSelectionChanged(boolean isIncluded)
このメニューをアクティブにするか、アクティブではなくするためにメニュー・バーの選択が変更されたときに、メッセージを送ります。 これはjavax.swing.MenuElementインタフェースを実装します。MenuElement.menuSelectionChangedをオーバーライドします。- 定義:
menuSelectionChanged、インタフェース:MenuElement- パラメータ:
isIncluded- このメニューがアクティブな場合はtrue、そうでない場合はfalse- 関連項目:
MenuElement.menuSelectionChanged(boolean)
-
getSubElements
@BeanProperty(bound=false) public MenuElement[] getSubElements()
このメニュー・コンポーネントのサブメニューを格納するMenuElementの配列を返します。JMenuElementインタフェースに適合する項目だけを返します。 ポップアップ・メニューがnullの場合は空の配列を返します。 このメソッドは、MenuElementインタフェースに適合するために必要です。- 定義:
getSubElements、インタフェース:MenuElement- 戻り値:
MenuElementオブジェクトの配列- 関連項目:
MenuElement.getSubElements()
-
getComponent
public Component getComponent()
このJPopupMenuコンポーネントを返します。- 定義:
getComponent、インタフェース:MenuElement- 戻り値:
- この
JPopupMenuオブジェクト - 関連項目:
MenuElement.getComponent()
-
isPopupTrigger
public boolean isPopupTrigger(MouseEvent e)
JPopupMenuの現在インストールされているUIがMouseEventをポップアップ・トリガーと見なす場合は、trueを返します。- パラメータ:
e- aMouseEvent- 戻り値:
- マウス・イベントがポップアップ・トリガーの場合はtrue
- 導入されたバージョン:
- 1.3
-
-