- 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 class
BasicMenuItemUI.MouseInputHandler
マウス入力ハンドラ
-
フィールドのサマリー
フィールド 修飾子と型 フィールド 説明 protected String
acceleratorDelimiter
アクセラレータ区切り文字列、'Ctrl+C'
の'+'
など。protected Font
acceleratorFont
アクセラレータ・フォント。protected Color
acceleratorForeground
アクセラレータの前景色。protected Color
acceleratorSelectionForeground
アクセラレータ選択の色。protected Icon
arrowIcon
矢印アイコン。protected Icon
checkIcon
チェック・アイコン。protected int
defaultTextIconGap
テキストとアイコンの間のギャップ。protected Color
disabledForeground
無効なフォアグラウンドの色。protected MenuDragMouseListener
menuDragMouseListener
MenuDragMouseListener
のインスタンス。protected JMenuItem
menuItem
JMenuItem
のインスタンス。protected MenuKeyListener
menuKeyListener
MenuKeyListener
のインスタンス。protected MouseInputListener
mouseInputListener
MouseInputListener
のインスタンス。protected boolean
oldBorderPainted
この値は、古いボーダーがペイントされているかどうかを表します。protected PropertyChangeListener
propertyChangeListener
createPropertyChangeListener
から返されたPropertyChangeListener
。protected Color
selectionBackground
選択したバックグラウンドの色です。protected Color
selectionForeground
選択前景の色です。
-
コンストラクタのサマリー
コンストラクタ コンストラクタ 説明 BasicMenuItemUI()
-
メソッドのサマリー
修飾子と型 メソッド 説明 protected MenuDragMouseListener
createMenuDragMouseListener(JComponent c)
MenuDragMouseListener
のインスタンスを返します。protected MenuKeyListener
createMenuKeyListener(JComponent c)
MenuKeyListener
のインスタンスを返します。protected MouseInputListener
createMouseInputListener(JComponent c)
MouseInputListener
のインスタンスを返します。protected PropertyChangeListener
createPropertyChangeListener(JComponent c)
メニュー項目に追加されるPropertyChangeListener
を作成します。static ComponentUI
createUI(JComponent c)
BasicMenuItemUI
の新しいインスタンスを返します。protected void
doClick(MenuSelectionManager msm)
メニュー項目の起動時に、このメソッドを呼び出します。MenuElement[]
getPath()
メニュー要素のパスを返します。protected Dimension
getPreferredMenuItemSize(JComponent c, Icon checkIcon, Icon arrowIcon, int defaultTextIconGap)
メニュー・アイテムの優先サイズを返します。protected String
getPropertyPrefix()
プロパティのプレフィクスを返します。protected void
installComponents(JMenuItem menuItem)
protected void
installDefaults()
デフォルトのプロパティをインストールします。protected void
installKeyboardActions()
キーボード操作を登録します。protected void
installListeners()
リスナーを登録します。protected void
paintBackground(Graphics g, JMenuItem menuItem, Color bgColor)
メニュー項目のバックグラウンドを描画します。protected void
paintMenuItem(Graphics g, JComponent c, Icon checkIcon, Icon arrowIcon, Color background, Color foreground, int defaultTextIconGap)
メニュー・アイテムをペイントします。protected void
paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text)
現在のメニュー項目のテキストをレンダリングします。protected void
uninstallComponents(JMenuItem menuItem)
コンポーネントの登録を解除します。protected void
uninstallDefaults()
デフォルト・プロパティをアンインストールします。protected void
uninstallKeyboardActions()
キーボード・アクションを登録解除します。protected void
uninstallListeners()
リスナーの登録を解除します。void
update(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 menuItem
JMenuItem
のインスタンス。
-
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 mouseInputListener
MouseInputListener
のインスタンス。
-
menuDragMouseListener
protected MenuDragMouseListener menuDragMouseListener
MenuDragMouseListener
のインスタンス。
-
menuKeyListener
protected MenuKeyListener menuKeyListener
MenuKeyListener
のインスタンス。
-
propertyChangeListener
protected PropertyChangeListener propertyChangeListener
createPropertyChangeListener
から返されたPropertyChangeListener
。 このフィールドにアクセスする必要はないはずです。PropertyChangeListener
をカスタマイズする場合は、createPropertyChangeListener
をオーバーライドしてください。- 導入されたバージョン:
- 1.6
- 関連項目:
createPropertyChangeListener(javax.swing.JComponent)
-
arrowIcon
protected Icon arrowIcon
矢印アイコン。
-
checkIcon
protected Icon checkIcon
チェック・アイコン。
-
oldBorderPainted
protected boolean oldBorderPainted
この値は、古いボーダーがペイントされているかどうかを表します。
-
-
メソッドの詳細
-
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
protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor)
メニュー項目のバックグラウンドを描画します。- パラメータ:
g
- ペイント・グラフィックスmenuItem
- ペイントされるメニュー項目bgColor
- 選択バックグラウンド・カラー- 導入されたバージョン:
- 1.4
-
paintText
protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text)
現在のメニュー項目のテキストをレンダリングします。- パラメータ:
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)
-
-