public class EclipseMenuItemUI extends MenuItemUI
Modifier and Type | Class and Description |
---|---|
protected class |
EclipseMenuItemUI.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 |
defaultAccelEndGap |
protected int |
defaultShadowWidth |
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 |
protected Color |
shadowColor |
Constructor and Description |
---|
EclipseMenuItemUI() |
Modifier and Type | Method and Description |
---|---|
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.
|
Dimension |
getMaximumSize(JComponent c) |
Dimension |
getMinimumSize(JComponent c) |
ThemePainter |
getPainter() |
MenuElement[] |
getPath() |
protected Dimension |
getPreferredMenuItemSize(JComponent c,
Icon checkIcon,
Icon arrowIcon,
int textIconGap) |
Dimension |
getPreferredSize(JComponent c) |
protected String |
getPropertyPrefix() |
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)
Method which 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, getBaselineResizeBehavior
protected 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 Color shadowColor
protected int defaultAccelEndGap
protected int defaultShadowWidth
protected ThemePainter _painter
public static ComponentUI createUI(JComponent c)
public void installUI(JComponent c)
installUI
in class ComponentUI
protected void installDefaults()
protected void installComponents(JMenuItem menuItem)
menuItem
- the menu itemprotected String getPropertyPrefix()
protected void installListeners()
protected void installKeyboardActions()
public void uninstallUI(JComponent c)
uninstallUI
in class ComponentUI
protected void uninstallDefaults()
protected void uninstallComponents(JMenuItem menuItem)
menuItem
- the menu itemprotected void uninstallListeners()
protected void uninstallKeyboardActions()
protected MouseInputListener createMouseInputListener(JComponent c)
protected MenuDragMouseListener createMenuDragMouseListener(JComponent c)
protected MenuKeyListener createMenuKeyListener(JComponent c)
public Dimension getMinimumSize(JComponent c)
getMinimumSize
in class ComponentUI
public Dimension getPreferredSize(JComponent c)
getPreferredSize
in class ComponentUI
public Dimension getMaximumSize(JComponent c)
getMaximumSize
in class ComponentUI
protected Dimension getPreferredMenuItemSize(JComponent c, Icon checkIcon, Icon arrowIcon, int textIconGap)
public void update(Graphics g, JComponent c)
update
in class ComponentUI
public void paint(Graphics g, JComponent c)
paint
in class ComponentUI
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
- the paint graphicsmenuItem
- menu item to be paintedbgColor
- selection background colorprotected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text)
g
- Graphics contextmenuItem
- Current menu item to rendertextRect
- Bounding rectangle to render the text.text
- 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)