|
JavaTM Platform Standard Ed. 6 |
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JMenuBar
public class JMenuBar
メニューバーの実装です。メニューを構築するには、メニューバーに JMenu オブジェクトを追加します。ユーザーが JMenu オブジェクトを選択すると、対応する JPopupMenu が表示され、ユーザーは JMenuItem のいずれかを選択することができます。
メニューバーの使用方法の詳細と例については、「The Java Tutorial」の「How to Use Menus」を参照してください。
警告: Swing はスレッドに対して安全ではありません。詳細は、「Swing's Threading Policy」を参照してください。
警告: このクラスの直列化されたオブジェクトは、今後の Swing リリースと互換ではなくなる予定です。現在の直列化のサポートは、短期間の運用や、同じバージョンの Swing を実行するアプリケーション間の RMI に適しています。JDK Version 1.4 以降、すべての JavaBeans™ の長期間の運用サポートは、java.beans パッケージに追加されています。詳細は、XMLEncoder を参照してください。
JMenu,
JPopupMenu,
JMenuItem| 入れ子のクラスの概要 | |
|---|---|
protected class |
JMenuBar.AccessibleJMenuBar
このクラスは JMenuBar クラス用のアクセシビリティーサポートを実装しています。 |
| クラス javax.swing.JComponent から継承された入れ子のクラス/インタフェース |
|---|
JComponent.AccessibleJComponent |
| クラス java.awt.Container から継承された入れ子のクラス/インタフェース |
|---|
Container.AccessibleAWTContainer |
| クラス java.awt.Component から継承された入れ子のクラス/インタフェース |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| フィールドの概要 |
|---|
| クラス 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 |
| コンストラクタの概要 | |
|---|---|
JMenuBar()
新しいメニューバーを作成します。 |
|
| メソッドの概要 | |
|---|---|
JMenu |
add(JMenu c)
メニューバーの最後に、指定されたメニューを追加します。 |
void |
addNotify()
このメニューバーを現在のキーボードマネージャーに登録するために、 JComponent.addNotify をオーバーライドします。 |
AccessibleContext |
getAccessibleContext()
この JMenuBar に関連した AccessibleContext を返します。 |
Component |
getComponent()
MenuElement として実装されます。 |
Component |
getComponentAtIndex(int i)
推奨されていません。 getComponent(int i) に置き換えられました。 |
int |
getComponentIndex(Component c)
指定されたコンポーネントのインデックスを返します。 |
JMenu |
getHelpMenu()
メニューバーのヘルプメニューを取得します。 |
Insets |
getMargin()
メニューバーのボーダーとそのメニューの間のマージンを返します。 |
JMenu |
getMenu(int index)
メニューバーの指定された位置のメニューを返します。 |
int |
getMenuCount()
メニューバーの項目数を返します。 |
SingleSelectionModel |
getSelectionModel()
単一の選択を扱うモデルオブジェクトを返します。 |
MenuElement[] |
getSubElements()
MenuElement として実装され、このメニューバーのメニューを返します。 |
MenuBarUI |
getUI()
メニューバーの現在の UI を返します。 |
String |
getUIClassID()
このコンポーネントを描画する L&F クラスの名前を返します。 |
boolean |
isBorderPainted()
メニューバーのボーダーをペイントする必要がある場合に true を返します。 |
boolean |
isSelected()
メニューバーのコンポーネントが現在選択されている場合に true を返します。 |
void |
menuSelectionChanged(boolean isIncluded)
MenuElement として実装されますが、処理は行いません。 |
protected void |
paintBorder(Graphics g)
BorderPainted プロパティーが true の場合、メニューバーのボーダーをペイントします。 |
protected String |
paramString()
この JMenuBar の文字列表現を返します。 |
protected boolean |
processKeyBinding(KeyStroke ks,
KeyEvent e,
int condition,
boolean pressed)
すべての子メニューを確認するためにサブクラス化されます。 |
void |
processKeyEvent(KeyEvent e,
MenuElement[] path,
MenuSelectionManager manager)
MenuElement として実装されますが、処理は行いません。 |
void |
processMouseEvent(MouseEvent event,
MenuElement[] path,
MenuSelectionManager manager)
MenuElement として実装されますが、処理は行いません。 |
void |
removeNotify()
このメニューバーを現在のキーボードマネージャーから登録解除するために、 JComponent.addNotify をオーバーライドします。 |
void |
setBorderPainted(boolean b)
ボーダーをペイントするかどうかを設定します。 |
void |
setHelpMenu(JMenu menu)
ユーザーがメニューバーで「ヘルプ (help)」オプションを選択すると表示されるヘルプメニューを設定します。 |
void |
setMargin(Insets m)
メニューバーのボーダーとそのメニューの間のマージンを設定します。 |
void |
setSelected(Component sel)
現在選択されているコンポーネントを設定します。 |
void |
setSelectionModel(SingleSelectionModel model)
単一の選択を扱うモデルオブジェクトを設定します。 |
void |
setUI(MenuBarUI ui)
このコンポーネントを描画する L&F オブジェクトを設定します。 |
void |
updateUI()
現在の Look & Feel からの値を持つ UI プロパティーをリセットします。 |
| クラス java.lang.Object から継承されたメソッド |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| コンストラクタの詳細 |
|---|
public JMenuBar()
| メソッドの詳細 |
|---|
public MenuBarUI getUI()
setUI(javax.swing.plaf.MenuBarUI)public void setUI(MenuBarUI ui)
ui - 新しい MenuBarUI L&F オブジェクトUIDefaults.getUI(javax.swing.JComponent)public void updateUI()
JComponent 内の updateUIJComponent.updateUI()public String getUIClassID()
JComponent 内の getUIClassIDJComponent.getUIClassID(),
UIDefaults.getUI(javax.swing.JComponent)public SingleSelectionModel getSelectionModel()
SingleSelectionModel プロパティーSingleSelectionModelpublic void setSelectionModel(SingleSelectionModel model)
model - 使用する SingleSelectionModelSingleSelectionModelpublic JMenu add(JMenu c)
c - 追加する JMenu コンポーネント
public JMenu getMenu(int index)
index - メニューバーの位置を示す整数。0 は先頭位置
JMenu。その位置に JMenu がない場合、たとえばそれが JMenuItem の場合は nullpublic int getMenuCount()
public void setHelpMenu(JMenu menu)
menu - ユーザーにヘルプを提示する JMenupublic JMenu getHelpMenu()
JMenu@Deprecated public Component getComponentAtIndex(int i)
getComponent(int i) に置き換えられました。
i - 位置を示す整数。0 は先頭
Component。
インデックスが無効の場合は nullpublic int getComponentIndex(Component c)
c - 検索対象の Component
public void setSelected(Component sel)
sel - 選択する Componentpublic boolean isSelected()
public boolean isBorderPainted()
public void setBorderPainted(boolean b)
b - このパラメータが true で、ボーダーのプロパティーが null でない場合、ボーダーをペイントするisBorderPainted()protected void paintBorder(Graphics g)
BorderPainted プロパティーが true の場合、メニューバーのボーダーをペイントします。
JComponent 内の paintBorderg - ペイントに使用する Graphics コンテキストJComponent.paint(java.awt.Graphics),
JComponent.setBorder(javax.swing.border.Border)public void setMargin(Insets m)
null に設定すると、メニューバーのマージンにはデフォルトが使用されます。
m - マージン値を保持する Insets オブジェクトInsetspublic Insets getMargin()
Insets オブジェクトInsets
public void processMouseEvent(MouseEvent event,
MenuElement[] path,
MenuSelectionManager manager)
MenuElement として実装されますが、処理は行いません。
MenuElement 内の processMouseEventgetSubElements()
public void processKeyEvent(KeyEvent e,
MenuElement[] path,
MenuSelectionManager manager)
MenuElement として実装されますが、処理は行いません。
MenuElement 内の processKeyEventgetSubElements()public void menuSelectionChanged(boolean isIncluded)
MenuElement として実装されますが、処理は行いません。
MenuElement 内の menuSelectionChangedgetSubElements()public MenuElement[] getSubElements()
MenuElement として実装され、このメニューバーのメニューを返します。メニューバーをほかのメニュー要素と同じように扱えるようにするために、MenuElement インタフェースを実装します。
MenuElement 内の getSubElementspublic Component getComponent()
MenuElement として実装されます。このオブジェクトを返します。
MenuElement 内の getComponentComponent (this オブジェクト)getSubElements()protected String paramString()
JMenuBar の文字列表現を返します。このメソッドはデバッグ専用であり、返される文字列の内容および形式は実装によって異なります。返される文字列は空の場合がありますが、null にはなりません。
JComponent 内の paramStringJMenuBar の文字列表現public AccessibleContext getAccessibleContext()
Accessible 内の getAccessibleContextJComponent 内の getAccessibleContext
protected boolean processKeyBinding(KeyStroke ks,
KeyEvent e,
int condition,
boolean pressed)
JComponent 内の processKeyBindingks - 照会する KeyStrokee - KeyEventcondition - 次の値のいずれか。
pressed - キーが押されている場合は true
public void addNotify()
JComponent.addNotify をオーバーライドします。
JComponent 内の addNotifyJComponent.registerKeyboardAction(java.awt.event.ActionListener, java.lang.String, javax.swing.KeyStroke, int)public void removeNotify()
JComponent.addNotify をオーバーライドします。
JComponent 内の removeNotifyJComponent.registerKeyboardAction(java.awt.event.ActionListener, java.lang.String, javax.swing.KeyStroke, int)
|
JavaTM Platform Standard Ed. 6 |
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
Copyright 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Documentation Redistribution Policy も参照してください。