クラスJPopupMenu
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 classこのクラスはJPopupMenuクラスのアクセシビリティ・サポートを実装しています。static classポップアップ・メニュー固有のセパレータです。クラスjavax.swing.JComponentで宣言されたネストされたクラス/インタフェース
JComponent.AccessibleJComponentクラスjava.awt.Containerで宣言されたネストされたクラス/インタフェース
Container.AccessibleAWTContainerクラスjava.awt.Componentで宣言されたネストされたクラス/インタフェース
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
フィールドのサマリー
クラスjavax.swing.JComponentで宣言されたフィールド
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWクラス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 -
コンストラクタのサマリー
コンストラクタコンストラクタ説明呼出しコンポーネントの定義なしでJPopupMenuを構築します。JPopupMenu(String label) 指定されたタイトルを使用してJPopupMenuを構築します。 -
メソッドのサマリー
修飾子と型メソッド説明指定されたテキストを持つ新しいメニュー項目を作成して、このメニューの末尾に追加します。メニューの末尾に、指定されたActionオブジェクトをディスパッチするメニュー項目を追加します。指定されたメニュー項目をメニューの末尾に追加します。voidポップアップ・メニューにMenuKeyListenerを追加します。voidPopupMenuリスナーを追加します。voidメニューの末尾に新しいセパレータを追加します。protected PropertyChangeListenerActionに対する変更が発生した場合にコントロールを更新する、適切に構成されたPropertyChangeListenerを返します。protected JMenuItemJPopupMenuに追加されるActionsのJMenuItemを作成するファクトリ・メソッドです。protected voidPopupMenuListenersに、このポップアップ・メニューが取り消されたことを通知します。protected voidPopupMenuListenerに、このポップアップ・メニューが不可視になることを通知します。protected voidPopupMenuListenerに、このポップアップ・メニューが可視になることを通知します。このJPopupMenuに関連付けられたAccessibleContextを取得します。このJPopupMenuコンポーネントを返します。getComponentAtIndex(int i) 非推奨。int指定されたコンポーネントのインデックスを返します。static booleandefaultLightWeightPopupEnabledプロパティを取得します。デフォルトではtrueです。このポップアップ・メニューの呼出し側であるコンポーネントを返します。getLabel()ポップアップ・メニューのラベルを返します。ポップアップ・メニューのボーダーとコンテナの間にあるマージンを返します(ピクセル単位)。addMenuKeyListener()を使用してこのJPopupMenuに追加されたすべてのMenuKeyListenerの配列を返します。addPopupMenuListener()を使用してこのJMenuItemに追加されたすべてのPopupMenuListenerの配列を返します。単一の選択を扱うモデル・オブジェクトを返します。このメニュー・コンポーネントのサブメニューを格納するMenuElementの配列を返します。getUI()このコンポーネントを描画するルック・アンド・フィール (L&F)オブジェクトを返します。このコンポーネントをレンダリングするL&Fクラスの名前を返します。void指定されたコンポーネントを、メニューの指定された位置に挿入します。void指定されたActionオブジェクトを、メニュー項目として指定の位置に挿入します。booleanボーダーをペイントするかどうかを調べます。booleanlightWeightPopupEnabledプロパティを取得します。booleanJPopupMenuの現在インストールされているUIがMouseEventをポップアップ・トリガーと見なす場合は、trueを返します。booleanポップアップ・メニューが可視(現在表示中)である場合にtrueを返します。voidmenuSelectionChanged(boolean isIncluded) このメニューをアクティブにするか、アクティブではなくするためにメニュー・バーの選択が変更されたときに、メッセージを送ります。voidpack()コンテナをレイアウトして、内容の表示に最小限の空間を使用するようにします。protected voidborderPaintedプロパティがtrueである場合に、ポップアップ・メニューのボーダーをペイントします。protected Stringこの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) 指定されたインデックスにあるコンポーネントをこのポップアップ・メニューから削除します。voidポップアップ・メニューからMenuKeyListenerを削除します。voidPopupMenuリスナーを削除します。voidsetBorderPainted(boolean b) ボーダーをペイントするかどうかを設定します。static voidsetDefaultLightWeightPopupEnabled(boolean aFlag) lightWeightPopupEnabledプロパティのデフォルト値を設定します。voidsetInvoker(Component invoker) このポップアップ・メニューの実行者を設定します -- ポップアップ・メニューが表示されるコンポーネント。voidポップアップ・メニューのラベルを設定します。voidsetLightWeightPopupEnabled(boolean aFlag) lightWeightPopupEnabledプロパティの値を設定します。デフォルトではtrueです。voidsetLocation(int x, int y) x、y座標を使って、ポップアップ・メニューの左上隅の位置を設定します。voidsetPopupSize(int width, int height) ポップアップ・ウィンドウのサイズを、指定された幅および高さに設定します。voidDimensionオブジェクトを使用して、Popupウィンドウのサイズを設定します。voidsetSelected(Component sel) 現在選択されるコンポーネントを設定します。結果として、選択モデルが変更されます。void単一の選択を扱うモデル・オブジェクトを設定します。voidsetUI(PopupMenuUI ui) このコンポーネントをレンダリングするL&Fオブジェクトを設定します。voidsetVisible(boolean b) ポップアップ・メニューの可視性を設定します。void呼出しコンポーネント内のx、y座標で指定された位置に、ポップアップ・メニューを表示します。voidupdateUI()現在のルック・アンド・フィールからの値にUIプロパティをリセットします。クラス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, 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, updateクラス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クラス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, 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
-
コンストラクタの詳細
-
JPopupMenu
public JPopupMenu()呼出しコンポーネントの定義なしでJPopupMenuを構築します。 -
JPopupMenu
public JPopupMenu(String label) 指定されたタイトルを使用してJPopupMenuを構築します。- パラメータ:
label- ポップアップ・メニューのタイトルとしてUIが使用できる文字列。
-
-
メソッドの詳細
-
setDefaultLightWeightPopupEnabled
public static void setDefaultLightWeightPopupEnabled(boolean aFlag) lightWeightPopupEnabledプロパティのデフォルト値を設定します。- パラメータ:
aFlag- ポップアップが軽量の場合はtrue、そうでない場合はfalse- 関連項目:
-
getDefaultLightWeightPopupEnabled
public static boolean getDefaultLightWeightPopupEnabled()defaultLightWeightPopupEnabledプロパティを取得します。デフォルトではtrueです。- 戻り値:
defaultLightWeightPopupEnabledプロパティの値- 関連項目:
-
getUI
public PopupMenuUI getUI()このコンポーネントを描画するルック・アンド・フィール (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オブジェクト- 関連項目:
-
updateUI
-
getUIClassID
@BeanProperty(bound=false) public String getUIClassID()このコンポーネントをレンダリングするL&Fクラスの名前を返します。- オーバーライド:
getUIClassID、クラスJComponent- 戻り値:
- 文字列「PopupMenuUI」
- 関連項目:
-
processKeyEvent
protected void processKeyEvent(KeyEvent evt) ニーモニックやアクセラレータなどの、キー・ストローク・イベントを処理します。- オーバーライド:
processKeyEvent、クラスJComponent- パラメータ:
evt- 処理されるキー・イベント- 関連項目:
-
getSelectionModel
public SingleSelectionModel getSelectionModel()単一の選択を扱うモデル・オブジェクトを返します。- 戻り値:
selectionModelプロパティ- 関連項目:
-
setSelectionModel
@BeanProperty(bound=false, expert=true, description="The selection model for the popup menu") public void setSelectionModel(SingleSelectionModel model) 単一の選択を扱うモデル・オブジェクトを設定します。- パラメータ:
model- 新しいSingleSelectionModel- 関連項目:
-
add
-
add
-
add
-
createActionComponent
-
createActionChangeListener
protected PropertyChangeListener createActionChangeListener(JMenuItem b) Actionに対する変更が発生した場合にコントロールを更新する、適切に構成されたPropertyChangeListenerを返します。- パラメータ:
b- リスナーを作成するメニュー項目- 戻り値:
- 適切に構成された
PropertyChangeListener
-
remove
public void remove(int pos) 指定されたインデックスにあるコンポーネントをこのポップアップ・メニューから削除します。- オーバーライド:
remove、クラスContainer- パラメータ:
pos- 削除される項目の位置- 例外:
IllegalArgumentException-posの値が0より小さいか、posの値がメニュー項目の数より大きい場合- 関連項目:
-
setLightWeightPopupEnabled
@BeanProperty(bound=false, expert=true, description="Determines whether lightweight popups are used when possible") public void setLightWeightPopupEnabled(boolean aFlag) lightWeightPopupEnabledプロパティの値を設定します。デフォルトではtrueです。 ルック・アンド・フィールがポップアップを表示するとき、デフォルトでは軽量(Java共通言語)ポップアップの使用を選択できます。 軽量ポップアップ・ウィンドウは重量(ネイティブ・ピア)ウィンドウよりも効率的ですが、軽量コンポーネントと重量コンポーネントはGUI内でうまく混在しません。 アプリケーションで軽量コンポーネントと重量コンポーネントが混在している場合は、軽量ポップアップを無効にする必要があります。 一部のルック・アンド・フィールでは、このプロパティの値に関係なく常に重量ポップアップが使用されることがあります。- パラメータ:
aFlag- 軽量ポップアップを無効にする場合はfalse- 関連項目:
-
isLightWeightPopupEnabled
public boolean isLightWeightPopupEnabled()lightWeightPopupEnabledプロパティを取得します。- 戻り値:
lightWeightPopupEnabledプロパティの値- 関連項目:
-
getLabel
-
setLabel
@BeanProperty(description="The label for the popup menu.") public void setLabel(String label) ポップアップ・メニューのラベルを設定します。 ルック・アンド・フィールの実装ごとに、ラベルを表示するかどうかを選択してもかまいません。- パラメータ:
label- ポップアップ・メニューのラベルを指定する文字列- 関連項目:
-
addSeparator
public void addSeparator()メニューの末尾に新しいセパレータを追加します。 -
insert
public void insert(Action a, int index) 指定されたActionオブジェクトを、メニュー項目として指定の位置に挿入します。- パラメータ:
a- 挿入するActionオブジェクトindex-Actionを挿入する位置。0はメニューの先頭- 例外:
IllegalArgumentException-indexが0未満の場合- 関連項目:
-
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- 関連項目:
-
isVisible
-
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座標- 関連項目:
-
getInvoker
-
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
@BeanProperty(bound=false, description="Is the border of the popup menu painted") public void setBorderPainted(boolean b) ボーダーをペイントするかどうかを設定します。- パラメータ:
b- trueの場合はボーダーがペイントされる。- 関連項目:
-
paintBorder
protected void paintBorder(Graphics g) borderPaintedプロパティがtrueである場合に、ポップアップ・メニューのボーダーをペイントします。- オーバーライド:
paintBorder、クラスJComponent- パラメータ:
g-Graphicsオブジェクト- 関連項目:
-
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- 関連項目:
-
processKeyEvent
public void processKeyEvent(KeyEvent e, MenuElement[] path, MenuSelectionManager manager) MenuSelectionManagerから転送されるキー・イベントを処理し、必要に応じてMenuSelectionManagerのAPIを使用して、メニュー選択を変更します。ノート: イベントをサブコンポーネントに転送する必要はありません。
MenuSelectionManagerが自動的に行います。- 定義:
processKeyEvent、インタフェースMenuElement- パラメータ:
e- aKeyEventpath-MenuElementパス配列manager-MenuSelectionManager
-
getSubElements
@BeanProperty(bound=false) public MenuElement[] getSubElements()このメニュー・コンポーネントのサブメニューを格納するMenuElementの配列を返します。JMenuElementインタフェースに適合する項目だけを返します。 ポップアップ・メニューがnullの場合は空の配列を返します。 このメソッドは、MenuElementインタフェースに適合するために必要です。- 定義:
getSubElements、インタフェースMenuElement- 戻り値:
MenuElementオブジェクトの配列- 関連項目:
-
getComponent
public Component getComponent()このJPopupMenuコンポーネントを返します。- 定義:
getComponent、インタフェースMenuElement- 戻り値:
- この
JPopupMenuオブジェクト - 関連項目:
-
isPopupTrigger
public boolean isPopupTrigger(MouseEvent e) JPopupMenuの現在インストールされているUIがMouseEventをポップアップ・トリガーと見なす場合は、trueを返します。- パラメータ:
e- aMouseEvent- 戻り値:
- マウス・イベントがポップアップ・トリガーの場合はtrue
- 導入されたバージョン:
- 1.3
-
Container.getComponent(int)に置き換えられています