java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.ButtonUI
javax.swing.plaf.MenuItemUI
javax.swing.plaf.basic.BasicMenuItemUI
- 直系の既知のサブクラス:
BasicCheckBoxMenuItemUI,BasicMenuUI,BasicRadioButtonMenuItemUI,SynthMenuItemUI
public class BasicMenuItemUI extends MenuItemUI
BasicMenuItem実装です。
-
ネストされたクラスのサマリー
ネストされたクラス 修飾子と型 クラス 説明 protected classBasicMenuItemUI.MouseInputHandlerマウス入力ハンドラ -
フィールドのサマリー
フィールド 修飾子と型 フィールド 説明 protected StringacceleratorDelimiterアクセラレータ区切り文字列、'Ctrl+C'の'+'など。protected FontacceleratorFontアクセラレータ・フォント。protected ColoracceleratorForegroundアクセラレータの前景色。protected ColoracceleratorSelectionForegroundアクセラレータ選択の色。protected IconarrowIcon矢印アイコン。protected IconcheckIconチェック・アイコン。protected intdefaultTextIconGapテキストとアイコンの間のギャップ。protected ColordisabledForeground無効なフォアグラウンドの色。protected MenuDragMouseListenermenuDragMouseListenerMenuDragMouseListenerのインスタンス。protected JMenuItemmenuItemJMenuItemのインスタンス。protected MenuKeyListenermenuKeyListenerMenuKeyListenerのインスタンス。protected MouseInputListenermouseInputListenerMouseInputListenerのインスタンス。protected booleanoldBorderPaintedこの値は、古いボーダーがペイントされているかどうかを表します。protected PropertyChangeListenerpropertyChangeListenercreatePropertyChangeListenerから返されたPropertyChangeListener。protected ColorselectionBackground選択したバックグラウンドの色です。protected ColorselectionForeground選択前景の色です。 -
コンストラクタのサマリー
コンストラクタ コンストラクタ 説明 BasicMenuItemUI() -
メソッドのサマリー
修飾子と型 メソッド 説明 protected MenuDragMouseListenercreateMenuDragMouseListener(JComponent c)MenuDragMouseListenerのインスタンスを返します。protected MenuKeyListenercreateMenuKeyListener(JComponent c)MenuKeyListenerのインスタンスを返します。protected MouseInputListenercreateMouseInputListener(JComponent c)MouseInputListenerのインスタンスを返します。protected PropertyChangeListenercreatePropertyChangeListener(JComponent c)メニュー項目に追加されるPropertyChangeListenerを作成します。static ComponentUIcreateUI(JComponent c)BasicMenuItemUIの新しいインスタンスを返します。protected voiddoClick(MenuSelectionManager msm)メニュー項目の起動時に、このメソッドを呼び出します。MenuElement[]getPath()メニュー要素のパスを返します。protected DimensiongetPreferredMenuItemSize(JComponent c, Icon checkIcon, Icon arrowIcon, int defaultTextIconGap)メニュー・アイテムの優先サイズを返します。protected StringgetPropertyPrefix()プロパティのプレフィクスを返します。protected voidinstallComponents(JMenuItem menuItem)protected voidinstallDefaults()デフォルトのプロパティをインストールします。protected voidinstallKeyboardActions()キーボード操作を登録します。protected voidinstallListeners()リスナーを登録します。protected voidpaintBackground(Graphics g, JMenuItem menuItem, Color bgColor)メニュー項目のバックグラウンドを描画します。protected voidpaintMenuItem(Graphics g, JComponent c, Icon checkIcon, Icon arrowIcon, Color background, Color foreground, int defaultTextIconGap)メニュー・アイテムをペイントします。protected voidpaintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text)現在のメニュー項目のテキストをレンダリングします。protected voiduninstallComponents(JMenuItem menuItem)コンポーネントの登録を解除します。protected voiduninstallDefaults()デフォルト・プロパティをアンインストールします。protected voiduninstallKeyboardActions()キーボード・アクションを登録解除します。protected voiduninstallListeners()リスナーの登録を解除します。voidupdate(Graphics g, JComponent c)paintMenuItem()でバックグラウンドを描画するため、update (デフォルトでは不透明なコンポーネントのバックグラウンドを塗りつぶす)をオーバーライドしてpaint()を呼び出してください。クラス javax.swing.plaf.ComponentUIで宣言されたメソッド
contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, getPreferredSize, installUI, paint, uninstallUI
-
フィールド詳細
-
menuItem
protected JMenuItem menuItemJMenuItemのインスタンス。 -
selectionBackground
protected Color selectionBackground選択したバックグラウンドの色です。 -
selectionForeground
protected Color selectionForeground選択前景の色です。 -
disabledForeground
protected Color disabledForeground無効なフォアグラウンドの色。 -
acceleratorForeground
protected Color acceleratorForegroundアクセラレータの前景色。 -
acceleratorSelectionForeground
protected Color acceleratorSelectionForegroundアクセラレータ選択の色。 -
acceleratorDelimiter
protected String acceleratorDelimiterアクセラレータ区切り文字列、'Ctrl+C'の'+'など。- 導入されたバージョン:
- 1.7
-
defaultTextIconGap
protected int defaultTextIconGapテキストとアイコンの間のギャップ。 -
acceleratorFont
protected Font acceleratorFontアクセラレータ・フォント。 -
mouseInputListener
protected MouseInputListener mouseInputListenerMouseInputListenerのインスタンス。 -
menuDragMouseListener
protected MenuDragMouseListener menuDragMouseListenerMenuDragMouseListenerのインスタンス。 -
menuKeyListener
protected MenuKeyListener menuKeyListenerMenuKeyListenerのインスタンス。 -
propertyChangeListener
protected PropertyChangeListener propertyChangeListenercreatePropertyChangeListenerから返されたPropertyChangeListener。 このフィールドにアクセスする必要はないはずです。PropertyChangeListenerをカスタマイズする場合は、createPropertyChangeListenerをオーバーライドしてください。- 導入されたバージョン:
- 1.6
- 関連項目:
createPropertyChangeListener(javax.swing.JComponent)
-
arrowIcon
protected Icon arrowIcon矢印アイコン。 -
checkIcon
protected Icon checkIconチェック・アイコン。 -
oldBorderPainted
protected boolean oldBorderPaintedこの値は、古いボーダーがペイントされているかどうかを表します。
-
-
コンストラクタの詳細
-
BasicMenuItemUI
public BasicMenuItemUI()
-
-
メソッドの詳細
-
createUI
public static ComponentUI createUI(JComponent c)BasicMenuItemUIの新しいインスタンスを返します。- パラメータ:
c- コンポーネント- 戻り値:
BasicMenuItemUIの新しいインスタンス
-
installDefaults
protected void installDefaults()デフォルトのプロパティをインストールします。 -
installComponents
protected void installComponents(JMenuItem menuItem)- パラメータ:
menuItem- メニュー・アイテム- 導入されたバージョン:
- 1.3
-
getPropertyPrefix
protected String getPropertyPrefix()プロパティのプレフィクスを返します。- 戻り値:
- プロパティ・プレフィクス
-
installListeners
protected void installListeners()リスナーを登録します。 -
installKeyboardActions
protected void installKeyboardActions()キーボード操作を登録します。 -
uninstallDefaults
protected void uninstallDefaults()デフォルト・プロパティをアンインストールします。 -
uninstallComponents
protected void uninstallComponents(JMenuItem menuItem)コンポーネントの登録を解除します。- パラメータ:
menuItem- メニュー・アイテム- 導入されたバージョン:
- 1.3
-
uninstallListeners
protected void uninstallListeners()リスナーの登録を解除します。 -
uninstallKeyboardActions
protected void uninstallKeyboardActions()キーボード・アクションを登録解除します。 -
createMouseInputListener
protected MouseInputListener createMouseInputListener(JComponent c)MouseInputListenerのインスタンスを返します。- パラメータ:
c- コンポーネント- 戻り値:
MouseInputListenerのインスタンス
-
createMenuDragMouseListener
protected MenuDragMouseListener createMenuDragMouseListener(JComponent c)MenuDragMouseListenerのインスタンスを返します。- パラメータ:
c- コンポーネント- 戻り値:
MenuDragMouseListenerのインスタンス
-
createMenuKeyListener
protected MenuKeyListener createMenuKeyListener(JComponent c)MenuKeyListenerのインスタンスを返します。- パラメータ:
c- コンポーネント- 戻り値:
MenuKeyListenerのインスタンス
-
createPropertyChangeListener
protected PropertyChangeListener createPropertyChangeListener(JComponent c)メニュー項目に追加されるPropertyChangeListenerを作成します。 このメソッドがnullを返す場合、これはメニュー項目に追加されません。- パラメータ:
c- コンポーネント- 戻り値:
PropertyChangeListenerのインスタンス、またはnull- 導入されたバージョン:
- 1.6
-
getPreferredMenuItemSize
protected Dimension getPreferredMenuItemSize(JComponent c, Icon checkIcon, Icon arrowIcon, int defaultTextIconGap)メニュー・アイテムの優先サイズを返します。- パラメータ:
c- コンポーネントcheckIcon- チェック・アイコンarrowIcon- 矢印アイコンdefaultTextIconGap- テキストとアイコンの間の隙間- 戻り値:
- メニュー・アイテムの優先サイズ
-
update
public void update(Graphics g, JComponent c)paintMenuItem()でバックグラウンドを描画するため、update (デフォルトでは不透明なコンポーネントのバックグラウンドを塗りつぶす)をオーバーライドしてpaint()を呼び出してください。- オーバーライド:
update、クラス:ComponentUI- パラメータ:
g- ペイント対象のGraphicsコンテキストc- ペイントされるコンポーネント。この引数は通常無視されるが、UIオブジェクトがステートレスで、複数のコンポーネントで共有されている場合は使用されることがある- 関連項目:
ComponentUI.paint(java.awt.Graphics, javax.swing.JComponent),JComponent.paintComponent(java.awt.Graphics)
-
paintMenuItem
protected void paintMenuItem(Graphics g, JComponent c, Icon checkIcon, Icon arrowIcon, Color background, Color foreground, int defaultTextIconGap)メニュー・アイテムをペイントします。- パラメータ:
g-Graphicsのインスタンスc- コンポーネントcheckIcon- チェック・アイコンarrowIcon- 矢印アイコンbackground- バックグラウンド色foreground- 前景色defaultTextIconGap- テキストとアイコンの間の隙間
-
paintBackground
メニュー項目のバックグラウンドを描画します。- パラメータ:
g- ペイント・グラフィックスmenuItem- ペイントされるメニュー項目bgColor- 選択バックグラウンド・カラー- 導入されたバージョン:
- 1.4
-
paintText
現在のメニュー項目のテキストをレンダリングします。- パラメータ:
g- グラフィックス・コンテキストmenuItem- レンダリングするメニュー項目textRect- テキストをレンダリングする境界矩形text- レンダリングする文字列- 導入されたバージョン:
- 1.4
-
getPath
public MenuElement[] getPath()メニュー要素のパスを返します。- 戻り値:
- メニュー要素のパス
-
doClick
protected void doClick(MenuSelectionManager msm)メニュー項目の起動時に、このメソッドを呼び出します。 このメソッドは、選択したパスを消去したり、JMenuItemのdoClick()メソッドをメッセージとして送るなど、メニュー項目起動の詳細の一部を処理します。- パラメータ:
msm- MenuSelectionManager。 視覚的フィード・バックとさまざまな内部作業は、このMenuSelectionManagerに委譲される。 この引数としてnullが渡された場合、MenuSelectionManager.defaultManagerが使用される。- 導入されたバージョン:
- 1.4
- 関連項目:
MenuSelectionManager,AbstractButton.doClick(int)
-