|
JavaTM 2 Platform Std. Ed. v1.3 |
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 内部クラス | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--javax.swing.JComponent
|
+--javax.swing.JPopupMenu
ポップアップメニューの実装です。ポップアップメニューは小さなウィンドウで、複数の選択肢 (メニューコマンド) を表示します。JPopupMenu は、メニューバー上の項目が選択されたときに表示するメニューに使います。また、選択したメニュー項目によっては表示されることもある、プルライトメニューにも使われます。あるいは、メニューを表示させたい他の場所 (メニューバー以外の場所) でも、JPopupMenu を使えます。たとえば、特定の場所で右クリックが発生した場合のポップアップメニュー表示 (ショートカットメニュー) などです。
ポップアップメニューの詳細と使用例については、「The Java Tutorial」の「How to Use Menus」を参照してください。標準の Look & Feel (L&F) 表現でこのコンポーネントが使うキーボードのキーについては、JPopupMenu のキー割り当てを参照してください。
警告: このクラスの直列化されたオブジェクトは、今後の Swing リリースと互換ではなくなる予定です。現在の直列化のサポートは、短期間の運用や、同じバージョンの Swing を実行するアプリケーション間の RMI に適しています。今後の Swing リリースでは、長期間の持続性をサポートする予定です。
| 内部クラスの概要 | |
protected class |
JPopupMenu.AccessibleJPopupMenu
このクラスは JPopupMenu クラス用のユーザ補助機能のサポートを実装しています。 |
static class |
JPopupMenu.Separator
ポップアップメニュー固有のセパレータです。 |
| クラス javax.swing.JComponent から継承した内部クラス |
JComponent.AccessibleJComponent |
| クラス java.awt.Container から継承した内部クラス |
Container.AccessibleAWTContainer |
| クラス java.awt.Component から継承した内部クラス |
Component.AccessibleAWTComponent |
| クラス javax.swing.JComponent から継承したフィールド |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| クラス java.awt.Component から継承したフィールド |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| インタフェース java.awt.image.ImageObserver から継承したフィールド |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| コンストラクタの概要 | |
JPopupMenu()
呼び出しコンポーネントの定義なしで JPopupMenu を構築します。 |
|
JPopupMenu(String label)
指定されたタイトルの PopupMenu を構築します。 |
|
| メソッドの概要 | |
JMenuItem |
add(Action a)
メニューの末尾に、指定された Action オブジェクトを振り分けるメニュー項目を追加します。
|
JMenuItem |
add(JMenuItem menuItem)
指定されたメニュー項目をメニューの末尾に追加します。 |
JMenuItem |
add(String s)
指定されたテキストを持つ新しいメニュー項目を作成して、このメニューの末尾に追加します。 |
void |
addPopupMenuListener(PopupMenuListener l)
PopupMenu リスナーを追加します。 |
void |
addSeparator()
メニューの末尾に新しいセパレータを追加します。 |
protected PropertyChangeListener |
createActionChangeListener(JMenuItem b)
Action に対する変更が発生した場合にコントロールを更新する、適切に設定された PropertyChangeListener を返します。 |
protected JMenuItem |
createActionComponent(Action a)
JPopupMenu に追加された Action の JMenuItem を作成するファクトリメソッドです。 |
protected void |
firePopupMenuCanceled()
PopupMenuListener に、ポップアップメニューが取り消されたことを通知します。 |
protected void |
firePopupMenuWillBecomeInvisible()
PopupMenuListener に、ポップアップメニューが不可視になることを通知します。 |
protected void |
firePopupMenuWillBecomeVisible()
PopupMenuListener に、ポップアップメニューが可視になることを通知します。 |
AccessibleContext |
getAccessibleContext()
この JPopupMenu に関連した AccessibleContext を返します。 |
Component |
getComponent()
この JPopupMenu コンポーネントを返します。 |
Component |
getComponentAtIndex(int i)
推奨されていません。 getComponent(int i) に置き換えられました。 |
int |
getComponentIndex(Component c)
指定されたコンポーネントのインデックスを返します。 |
static boolean |
getDefaultLightWeightPopupEnabled()
軽量ポップアップコンポーネントの場合は true を返し、そうでない場合は false を返します。 |
Component |
getInvoker()
ポップアップメニューの呼び出しコンポーネントを返します。 |
String |
getLabel()
ポップアップメニューのラベルを返します。 |
Insets |
getMargin()
ポップアップメニューのボーダと内容の間にあるマージンの値を返します (ピクセル単位)。 |
SingleSelectionModel |
getSelectionModel()
単一の選択を扱うモデルオブジェクトを返します。 |
MenuElement[] |
getSubElements()
このメニューコンポーネントのサブメニューを格納する MenuElement の配列を返します。 |
PopupMenuUI |
getUI()
このコンポーネントを描画する Look & Feel (L&F) オブジェクトを返します。 |
String |
getUIClassID()
このコンポーネントを描画する L&F クラスの名前を返します。 |
void |
insert(Action a,
int index)
指定された Action オブジェクトを、メニュー項目として指定の位置に挿入します。 |
void |
insert(Component component,
int index)
指定されたコンポーネントを、メニューの指定された位置に挿入します。 |
boolean |
isBorderPainted()
ボーダをペイントするかどうかを判定します。 |
boolean |
isLightWeightPopupEnabled()
軽量 (すべて Java の) ポップアップを使用している場合は true を返し、重量 (ネイティブピアの) ポップアップを使用している場合は false を返します。 |
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 の文字列表現を返します。 |
void |
processKeyEvent(KeyEvent e,
MenuElement[] path,
MenuSelectionManager manager)
このメソッドは MenuElement インタフェースに適合するために必要ですが、実装されていません。 |
void |
processMouseEvent(MouseEvent event,
MenuElement[] path,
MenuSelectionManager manager)
このメソッドは MenuElement インタフェースに適合するために必要ですが、実装されていません。 |
void |
remove(int pos)
指定されたインデックスにあるコンポーネントをこのポップアップメニューから削除します。 |
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)
ポップアップを表示するとき、それが適当であれば JPopupMenu は軽量ポップアップの使用を選択します。 |
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()
L&F が変更されたことを示す UIFactory からの通知です。 |
| クラス java.lang.Object から継承したメソッド |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| コンストラクタの詳細 |
public JPopupMenu()
JPopupMenu を構築します。public JPopupMenu(String label)
PopupMenu を構築します。label - ポップアップメニューのタイトルとして UI が使う文字列| メソッドの詳細 |
public static void setDefaultLightWeightPopupEnabled(boolean aFlag)
lightWeightPopupEnabled プロパティのデフォルト値を設定します。軽量ポップアップウィンドウは、重量ウィンドウよりも効率的ですが、軽量コンポーネントと重量コンポーネントを GUI の中で混在してはいけません。そのような場合は、重量コンポーネントを使用する必要があります。aFlag - ポップアップメニューが軽量コンポーネントの場合は true、そうでない場合は falsegetDefaultLightWeightPopupEnabled()public static boolean getDefaultLightWeightPopupEnabled()
lightWeightPopupEnabled プロパティsetDefaultLightWeightPopupEnabled(boolean)public PopupMenuUI getUI()
PopupMenuUI オブジェクトpublic void setUI(PopupMenuUI ui)
ui - 新規 PopupMenuUI L&F オブジェクトUIDefaults.getUI(javax.swing.JComponent)public void updateUI()
UIFactory からの通知です。UI を UIFactory からの最新バージョンに置き換えるために呼び出されます。JComponent 内の updateUIJComponent.updateUI()public String getUIClassID()
JComponent 内の getUIClassIDJComponent.getUIClassID(),
UIDefaults.getUI(javax.swing.JComponent)public SingleSelectionModel getSelectionModel()
selectionModel プロパティSingleSelectionModelpublic void setSelectionModel(SingleSelectionModel model)
model - 新規 SingleSelectionModelSingleSelectionModelpublic JMenuItem add(JMenuItem menuItem)
c - 追加する JMenuitemJMenuItempublic JMenuItem add(String s)
s - 追加されるメニュー項目の文字列public JMenuItem add(Action a)
Action オブジェクトを振り分けるメニュー項目を追加します。
JDK 1.3 以降は、コンテナに Action を追加する場合に、このメソッドを使用することは推奨されません。代わりに、setAction を使ってアクションを持つコントロールを設定し、そのコントロールを直接 Container に追加することをお勧めします。a - メニューに追加する ActionActionprotected JMenuItem createActionComponent(Action a)
JPopupMenu に追加された Action の JMenuItem を作成するファクトリメソッドです。JDK 1.3 以降は、このメソッドは推奨されません。代わりに、setAction を使ってアクションを持つコントロールを設定し、そのコントロールを直接 Container に追加することをお勧めします。a - 追加されるメニュー項目の ActionActionprotected PropertyChangeListener createActionChangeListener(JMenuItem b)
Action に対する変更が発生した場合にコントロールを更新する、適切に設定された PropertyChangeListener を返します。JDK 1.3 以降は、このメソッドはコンテナに Action を追加するメソッドとしては推奨されません。代わりに、setAction を使ってアクションを持つコントロールを設定し、そのコントロールを直接 Container に追加することをお勧めします。public void remove(int pos)
Container 内の removepos - 削除される項目の位置IllegalArgumentException - pos の値が 0 より小さいか、pos の値がメニュー項目の数より大きい場合public void setLightWeightPopupEnabled(boolean aFlag)
JPopupMenu は軽量ポップアップの使用を選択します。このメソッドでは、この機能を無効にできます。アプリケーションが軽量コンポーネントと重量コンポーネントを混在させる場合は、この機能を無効にしなければなりません。aFlag - ポップアップが軽量コンポーネントの場合は true、そうでない場合は falsepublic boolean isLightWeightPopupEnabled()
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 はメニューの先頭Action
public 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 - 削除する PopupMenuListenerprotected void firePopupMenuWillBecomeVisible()
PopupMenuListener に、ポップアップメニューが可視になることを通知します。protected void firePopupMenuWillBecomeInvisible()
PopupMenuListener に、ポップアップメニューが不可視になることを通知します。protected void firePopupMenuCanceled()
PopupMenuListener に、ポップアップメニューが取り消されたことを通知します。public void pack()
public void setVisible(boolean b)
JComponent 内の setVisibleb - ポップアップを可視にする場合は true、隠す場合は falsepublic boolean isVisible()
Component 内の isVisiblejava.awt.Component からコピーされたタグ:true、そうでない場合は falseComponent.setVisible(boolean)
public void setLocation(int x,
int y)
Component 内の setLocationx - ポップアップメニューの新しい位置の x 座標y - ポップアップメニューの新しい位置の y 座標public Component getInvoker()
Componentpublic void setInvoker(Component invoker)
invoker - ポップアップメニューが表示される Component
public void show(Component invoker,
int x,
int y)
invoker - ポップアップメニューが表示されるコンポーネントx - ポップアップメニューを表示する呼び出しコンポーネントの x 座標y - ポップアップメニューを表示する呼び出しコンポーネントの y 座標public Component getComponentAtIndex(int i)
getComponent(int i) に置き換えられました。
i - コンポーネントのインデックス。0 が先頭Componentpublic int getComponentIndex(Component c)
c - 検索する Componentpublic void setPopupSize(Dimension d)
Dimension オブジェクトを使用して、Popup ウィンドウのサイズを設定します。d - このコンポーネントの新しいサイズを指定する Dimension
public void setPopupSize(int width,
int 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 の場合、ポップアップメニューのボーダをペイントします。JComponent 内の paintBorderg - Graphics オブジェクトJComponent.paint(java.awt.Graphics),
JComponent.setBorder(javax.swing.border.Border)public Insets getMargin()
Insets オブジェクトprotected String paramString()
JPopupMenu の文字列表現を返します。このメソッドはデバッグ専用であり、返される文字列の内容および形式は実装によって異なります。返される文字列は空の場合がありますが、null にはなりません。JComponent 内の paramStringJPopupMenu の文字列表現public AccessibleContext getAccessibleContext()
Accessible 内の getAccessibleContextJComponent 内の getAccessibleContext
public void processMouseEvent(MouseEvent event,
MenuElement[] path,
MenuSelectionManager manager)
MenuElement インタフェースに適合するために必要ですが、実装されていません。MenuElement 内の processMouseEventMenuElement.processMouseEvent(MouseEvent, MenuElement[], MenuSelectionManager)
public void processKeyEvent(KeyEvent e,
MenuElement[] path,
MenuSelectionManager manager)
MenuElement インタフェースに適合するために必要ですが、実装されていません。MenuElement 内の processKeyEventMenuElement.processKeyEvent(KeyEvent, MenuElement[], MenuSelectionManager)public void menuSelectionChanged(boolean isIncluded)
javax.swing.MenuElement インタフェースを実装します。MenuElement.menuSelectionChanged をオーバーライドしてください。
- 定義:
- インタフェース
MenuElement 内の menuSelectionChanged
- パラメータ:
isIncluded - このメニューがアクティブな場合は true、そうでない場合は false- 関連項目:
MenuElement.menuSelectionChanged(boolean)
public MenuElement[] getSubElements()
MenuElement の配列を返します。JMenuElement インタフェースに適合する項目だけを返します。ポップアップメニューが null の場合は空の配列を返します。このメソッドは、MenuElement インタフェースに適合するために必要です。MenuElement 内の getSubElementsMenuElement オブジェクトの配列MenuElement.getSubElements()public Component getComponent()
JPopupMenu コンポーネントを返します。MenuElement 内の getComponentJPopupMenu オブジェクトMenuElement.getComponent()public boolean isPopupTrigger(MouseEvent e)
JPopupMenu の現在インストールされている UI が MouseEvent をポップアップトリガーと見なす場合は、true を返します。
|
JavaTM 2 Platform Std. Ed. v1.3 |
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 内部クラス | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
Java、Java 2D、JDBC は、米国およびその他の国における米国 Sun Microsystems, Inc. の商標もしくは登録商標です。
Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.