public class MetalMenuItemUI extends MenuItemUI
| Modifier and Type | Class and Description |
|---|---|
protected class |
MetalMenuItemUI.MouseInputHandler |
| Modifier and Type | Field and Description |
|---|---|
protected ThemePainter |
_painter |
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 Color |
selectionBackground |
protected Color |
selectionForeground |
| Constructor and Description |
|---|
MetalMenuItemUI() |
| Modifier and Type | Method and Description |
|---|---|
protected ActionMap |
createActionMap() |
protected InputMap |
createInputMap(int condition) |
protected MenuDragMouseListener |
createMenuDragMouseListener(JComponent c) |
protected MenuKeyListener |
createMenuKeyListener(JComponent c) |
protected MouseInputListener |
createMouseInputListener(JComponent c) |
static ComponentUI |
createUI(JComponent c) |
protected void |
doClick(MenuSelectionManager msm)
Call this method when a menu item is to be activated.
|
protected ActionMap |
getActionMap() |
Dimension |
getMaximumSize(JComponent c) |
Dimension |
getMinimumSize(JComponent c) |
ThemePainter |
getPainter() |
MenuElement[] |
getPath() |
protected Dimension |
getPreferredMenuItemSize(JComponent c,
Icon checkIcon,
Icon arrowIcon,
int defaultTextIconGap) |
Dimension |
getPreferredSize(JComponent c) |
protected String |
getPropertyPrefix() |
protected int |
getRightMargin() |
protected void |
installComponents(JMenuItem menuItem) |
protected void |
installDefaults() |
protected void |
installKeyboardActions() |
protected void |
installListeners() |
void |
installUI(JComponent c) |
protected boolean |
isDownArrowVisible(Container c) |
void |
paint(Graphics g,
JComponent c) |
protected void |
paintBackground(Graphics g,
JMenuItem menuItem,
Color bgColor)
Draws the background of the menu item.
|
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)
Renders the text of the current menu item.
|
protected void |
uninstallComponents(JMenuItem menuItem) |
protected void |
uninstallDefaults() |
protected void |
uninstallKeyboardActions() |
protected void |
uninstallListeners() |
void |
uninstallUI(JComponent c) |
void |
update(Graphics g,
JComponent c)
We draw the background in paintMenuItem() so override update (which fills the background of opaque components by
default) to just call paint().
|
contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehaviorprotected JMenuItem menuItem
protected Color selectionBackground
protected Color selectionForeground
protected Color disabledForeground
protected Color acceleratorForeground
protected Color acceleratorSelectionForeground
protected int defaultTextIconGap
protected Font acceleratorFont
protected MouseInputListener mouseInputListener
protected MenuDragMouseListener menuDragMouseListener
protected MenuKeyListener menuKeyListener
protected Icon arrowIcon
protected Icon checkIcon
protected boolean oldBorderPainted
protected ThemePainter _painter
public static ComponentUI createUI(JComponent c)
public void installUI(JComponent c)
installUI in class ComponentUIprotected void installDefaults()
protected void installComponents(JMenuItem menuItem)
protected String getPropertyPrefix()
protected void installListeners()
protected void installKeyboardActions()
public void uninstallUI(JComponent c)
uninstallUI in class ComponentUIprotected 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 ActionMap getActionMap()
protected ActionMap createActionMap()
protected InputMap createInputMap(int condition)
public Dimension getMinimumSize(JComponent c)
getMinimumSize in class ComponentUIpublic Dimension getPreferredSize(JComponent c)
getPreferredSize in class ComponentUIpublic Dimension getMaximumSize(JComponent c)
getMaximumSize in class ComponentUIprotected Dimension getPreferredMenuItemSize(JComponent c, Icon checkIcon, Icon arrowIcon, int defaultTextIconGap)
public void update(Graphics g, JComponent c)
update in class ComponentUIpublic void paint(Graphics g, JComponent c)
paint in class ComponentUIprotected 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 - the paint graphicsmenuItem - menu item to be paintedbgColor - selection background colorprotected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text)
g - graphics contextmenuItem - menu item to rendertextRect - bounding rectangle for rendering the texttext - string to renderpublic MenuElement[] getPath()
protected void doClick(MenuSelectionManager msm)
msm - A MenuSelectionManager. The visual feedback and internal bookkeeping tasks are delegated to this
MenuSelectionManager. If null is passed as this argument, the
MenuSelectionManager.defaultManager is used.MenuSelectionManager,
AbstractButton.doClick(int)public ThemePainter getPainter()
protected boolean isDownArrowVisible(Container c)
protected int getRightMargin()
Copyright © 2017. All rights reserved.