public class BasicMenuItemUI extends MenuItemUI
| 修飾子と型 | クラスと説明 |
|---|---|
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 |
protected JMenuItem |
menuItem |
protected MenuKeyListener |
menuKeyListener |
protected MouseInputListener |
mouseInputListener |
protected boolean |
oldBorderPainted |
protected PropertyChangeListener |
propertyChangeListener
createPropertyChangeListenerから返されたPropertyChangeListener。 |
protected Color |
selectionBackground |
protected Color |
selectionForeground |
| コンストラクタと説明 |
|---|
BasicMenuItemUI() |
| 修飾子と型 | メソッドと説明 |
|---|---|
protected MenuDragMouseListener |
createMenuDragMouseListener(JComponent c) |
protected MenuKeyListener |
createMenuKeyListener(JComponent c) |
protected MouseInputListener |
createMouseInputListener(JComponent c) |
protected PropertyChangeListener |
createPropertyChangeListener(JComponent c)
メニュー項目に追加される
PropertyChangeListenerを作成します。 |
static ComponentUI |
createUI(JComponent c) |
protected void |
doClick(MenuSelectionManager msm)
メニュー項目の起動時に、このメソッドを呼び出します。
|
Dimension |
getMaximumSize(JComponent c)
指定されたコンポーネントの、Look & Feelに適した最大サイズを返します。
|
Dimension |
getMinimumSize(JComponent c)
指定されたコンポーネントの、Look & Feelに適した最小サイズを返します。
|
MenuElement[] |
getPath() |
protected Dimension |
getPreferredMenuItemSize(JComponent c, Icon checkIcon, Icon arrowIcon, int defaultTextIconGap) |
Dimension |
getPreferredSize(JComponent c)
指定されたコンポーネントの、Look & Feelに適した推奨サイズを返します。
|
protected String |
getPropertyPrefix() |
protected void |
installComponents(JMenuItem menuItem) |
protected void |
installDefaults() |
protected void |
installKeyboardActions() |
protected void |
installListeners() |
void |
installUI(JComponent c)
指定されたコンポーネントをLook & Feelに応じて適切に構成します。
|
void |
paint(Graphics g, JComponent c)
指定されたコンポーネントをLook & Feelに合わせてペイントします。
|
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 |
uninstallUI(JComponent c)
installUI時に、指定されたコンポーネントに対して行われた構成を取り消します。 |
void |
update(Graphics g, JComponent c)
paintMenuItem()でバックグラウンドを描画するため、update (デフォルトでは不透明なコンポーネントのバックグラウンドを塗りつぶす)をオーバーライドしてpaint()を呼び出してください。
|
contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehaviorprotected JMenuItem menuItem
protected Color selectionBackground
protected Color selectionForeground
protected Color disabledForeground
protected Color acceleratorForeground
protected Color acceleratorSelectionForeground
protected String acceleratorDelimiter
'Ctrl+C'の'+'など。protected int defaultTextIconGap
protected Font acceleratorFont
protected MouseInputListener mouseInputListener
protected MenuDragMouseListener menuDragMouseListener
protected MenuKeyListener menuKeyListener
protected PropertyChangeListener propertyChangeListener
createPropertyChangeListenerから返されたPropertyChangeListener。このフィールドにアクセスする必要はないはずです。PropertyChangeListenerをカスタマイズする場合は、createPropertyChangeListenerをオーバーライドしてください。createPropertyChangeListener(javax.swing.JComponent)protected Icon arrowIcon
protected Icon checkIcon
protected boolean oldBorderPainted
public static ComponentUI createUI(JComponent c)
public void installUI(JComponent c)
ComponentUIComponentUIインスタンスが、指定されたコンポーネントのUI委譲としてインストールされているときに呼び出されます。このメソッドは、次を含むLook & Feel用のコンポーネントを完全に構成するべきです。
LayoutManagerをインストールする。
PropertyChangeListenerを作成してコンポーネントにインストールする。
installUI、クラス: ComponentUIc - UI委譲がインストールされるコンポーネントComponentUI.uninstallUI(javax.swing.JComponent), JComponent.setUI(javax.swing.plaf.ComponentUI), JComponent.updateUI()protected void installDefaults()
protected void installComponents(JMenuItem menuItem)
protected String getPropertyPrefix()
protected void installListeners()
protected void installKeyboardActions()
public void uninstallUI(JComponent c)
ComponentUIinstallUI時に、指定されたコンポーネントに対して行われた構成を取り消します。このメソッドは、このUIComponentインスタンスが、指定されたコンポーネントのUI委譲として削除されているときに呼び出されます。このメソッドは、installUIによって実行された構成を元に戻すべきです。この場合、JComponentインスタンスをクリーンな状態(余分なリスナーや、Look & Feel固有のプロパティ・オブジェクトが残らないように)にするよう十分注意してください。手順には次のものが含まれるべきです。
uninstallUI、クラス: ComponentUIc - このUI委譲が削除されるコンポーネント。この引数は通常無視されるが、UIオブジェクトがステートレスで、複数のコンポーネントで共有されている場合は使用されることがあるComponentUI.installUI(javax.swing.JComponent), JComponent.updateUI()protected void uninstallDefaults()
protected void uninstallComponents(JMenuItem menuItem)
protected void uninstallListeners()
protected void uninstallKeyboardActions()
protected MouseInputListener createMouseInputListener(JComponent c)
protected MenuDragMouseListener createMenuDragMouseListener(JComponent c)
protected MenuKeyListener createMenuKeyListener(JComponent c)
protected PropertyChangeListener createPropertyChangeListener(JComponent c)
PropertyChangeListenerを作成します。このメソッドがnullを返す場合、これはメニュー項目に追加されません。PropertyChangeListenerのインスタンス、またはnullpublic Dimension getMinimumSize(JComponent c)
ComponentUInullが返された場合、最小サイズは代わりにコンポーネントのレイアウト・マネージャによって計算されます(これは、特定のレイアウト・マネージャをインストールしてあるコンポーネントの場合に推奨する方法です)。このメソッドのデフォルト実装はgetPreferredSizeを呼び出して、その値を返します。getMinimumSize、クラス: ComponentUIc - 最小サイズが照会されるコンポーネント。この引数は通常無視されるが、UIオブジェクトがステートレスで、複数のコンポーネントで共有されている場合は使用されることがあるDimensionオブジェクトまたはnullJComponent.getMinimumSize(), LayoutManager.minimumLayoutSize(java.awt.Container), ComponentUI.getPreferredSize(javax.swing.JComponent)public Dimension getPreferredSize(JComponent c)
ComponentUInullが返された場合、適切なサイズは代わりにコンポーネントのレイアウト・マネージャによって計算されます(これは、特定のレイアウト・マネージャをインストールしてあるコンポーネントの場合に推奨する方法です)。このメソッドのデフォルト実装はnullを返します。getPreferredSize、クラス: ComponentUIc - 推奨サイズが照会されるコンポーネント。この引数は通常無視されるが、UIオブジェクトがステートレスで、複数のコンポーネントで共有されている場合は使用されることがあるJComponent.getPreferredSize(), LayoutManager.preferredLayoutSize(java.awt.Container)public Dimension getMaximumSize(JComponent c)
ComponentUInullが返された場合、最大サイズは代わりにコンポーネントのレイアウト・マネージャによって計算されます(これは、特定のレイアウト・マネージャをインストールしてあるコンポーネントの場合に推奨する方法です)。このメソッドのデフォルト実装はgetPreferredSizeを呼び出して、その値を返します。getMaximumSize、クラス: ComponentUIc - 最大サイズが照会されるコンポーネント。この引数は通常無視されるが、UIオブジェクトがステートレスで、複数のコンポーネントで共有されている場合は使用されることがあるDimensionオブジェクトまたはnullJComponent.getMaximumSize(), LayoutManager2.maximumLayoutSize(java.awt.Container)protected Dimension getPreferredMenuItemSize(JComponent c, Icon checkIcon, Icon arrowIcon, int defaultTextIconGap)
public void update(Graphics g, JComponent c)
update、クラス: ComponentUIg - ペイント対象のGraphicsコンテキストc - ペイントされるコンポーネント。この引数は通常無視されるが、UIオブジェクトがステートレスで、複数のコンポーネントで共有されている場合は使用されることがあるComponentUI.paint(java.awt.Graphics, javax.swing.JComponent), JComponent.paintComponent(java.awt.Graphics)public void paint(Graphics g, JComponent c)
ComponentUIComponentUI.updateメソッドから呼び出されます。サブクラスは、このメソッドをオーバーライドして、指定されたGraphicsオブジェクトを使ってコンポーネントの内容を描画するべきです。paint、クラス: ComponentUIg - ペイント対象のGraphicsコンテキストc - ペイントされるコンポーネント。この引数は通常無視されるが、UIオブジェクトがステートレスで、複数のコンポーネントで共有されている場合は使用されることがあるComponentUI.update(java.awt.Graphics, javax.swing.JComponent)protected void paintMenuItem(Graphics g, JComponent c, Icon checkIcon, Icon arrowIcon, Color background, Color foreground, int defaultTextIconGap)
protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor)
g - ペイントのグラフィックスmenuItem - ペイントされるメニュー項目bgColor - 選択バックグラウンド・カラーprotected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text)
g - グラフィックス・コンテキストmenuItem - レンダリングするメニュー項目textRect - テキストをレンダリングする境界矩形text - レンダリングする文字列public MenuElement[] getPath()
protected void doClick(MenuSelectionManager msm)
msm - MenuSelectionManager。視覚的フィード・バックとさまざまな内部作業は、このMenuSelectionManagerに委譲される。この引数としてnullが渡された場合、MenuSelectionManager.defaultManagerが使用される。MenuSelectionManager, AbstractButton.doClick(int) バグまたは機能を送信
詳細なAPIリファレンスおよび開発者ドキュメントについては、Java SEのドキュメントを参照してください。そのドキュメントには、概念的な概要、用語の定義、回避方法、有効なコード例などの、開発者を対象にしたより詳細な説明が含まれています。
Copyright© 1993, 2014, Oracle and/or its affiliates. All rights reserved.