Package com.jidesoft.plaf.metal
Class MetalMenuItemUI
- java.lang.Object
-
- javax.swing.plaf.ComponentUI
-
- javax.swing.plaf.ButtonUI
-
- javax.swing.plaf.MenuItemUI
-
- com.jidesoft.plaf.metal.MetalMenuItemUI
-
- Direct Known Subclasses:
MetalCheckBoxMenuItemUI
,MetalMenuUI
public class MetalMenuItemUI extends javax.swing.plaf.MenuItemUI
MetalMenuItem implementation
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
MetalMenuItemUI.MouseInputHandler
-
Field Summary
Fields Modifier and Type Field Description protected ThemePainter
_painter
protected java.awt.Font
acceleratorFont
protected java.awt.Color
acceleratorForeground
protected java.awt.Color
acceleratorSelectionForeground
protected javax.swing.Icon
arrowIcon
protected javax.swing.Icon
checkIcon
protected int
defaultTextIconGap
protected java.awt.Color
disabledForeground
protected javax.swing.event.MenuDragMouseListener
menuDragMouseListener
protected javax.swing.JMenuItem
menuItem
protected javax.swing.event.MenuKeyListener
menuKeyListener
protected javax.swing.event.MouseInputListener
mouseInputListener
protected boolean
oldBorderPainted
protected java.awt.Color
selectionBackground
protected java.awt.Color
selectionForeground
-
Constructor Summary
Constructors Constructor Description MetalMenuItemUI()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected javax.swing.ActionMap
createActionMap()
protected javax.swing.InputMap
createInputMap(int condition)
protected javax.swing.event.MenuDragMouseListener
createMenuDragMouseListener(javax.swing.JComponent c)
protected javax.swing.event.MenuKeyListener
createMenuKeyListener(javax.swing.JComponent c)
protected javax.swing.event.MouseInputListener
createMouseInputListener(javax.swing.JComponent c)
static javax.swing.plaf.ComponentUI
createUI(javax.swing.JComponent c)
protected void
doClick(javax.swing.MenuSelectionManager msm)
Call this method when a menu item is to be activated.protected javax.swing.ActionMap
getActionMap()
java.awt.Dimension
getMaximumSize(javax.swing.JComponent c)
java.awt.Dimension
getMinimumSize(javax.swing.JComponent c)
ThemePainter
getPainter()
javax.swing.MenuElement[]
getPath()
protected java.awt.Dimension
getPreferredMenuItemSize(javax.swing.JComponent c, javax.swing.Icon checkIcon, javax.swing.Icon arrowIcon, int defaultTextIconGap)
java.awt.Dimension
getPreferredSize(javax.swing.JComponent c)
protected java.lang.String
getPropertyPrefix()
protected int
getRightMargin()
protected void
installComponents(javax.swing.JMenuItem menuItem)
protected void
installDefaults()
protected void
installKeyboardActions()
protected void
installListeners()
void
installUI(javax.swing.JComponent c)
protected boolean
isDownArrowVisible(java.awt.Container c)
void
paint(java.awt.Graphics g, javax.swing.JComponent c)
protected void
paintBackground(java.awt.Graphics g, javax.swing.JMenuItem menuItem, java.awt.Color bgColor)
Draws the background of the menu item.protected void
paintMenuItem(java.awt.Graphics g, javax.swing.JComponent c, javax.swing.Icon checkIcon, javax.swing.Icon arrowIcon, java.awt.Color background, java.awt.Color foreground, int defaultTextIconGap)
protected void
paintText(java.awt.Graphics g, javax.swing.JMenuItem menuItem, java.awt.Rectangle textRect, java.lang.String text)
Renders the text of the current menu item.protected void
uninstallComponents(javax.swing.JMenuItem menuItem)
protected void
uninstallDefaults()
protected void
uninstallKeyboardActions()
protected void
uninstallListeners()
void
uninstallUI(javax.swing.JComponent c)
void
update(java.awt.Graphics g, javax.swing.JComponent c)
We draw the background in paintMenuItem() so override update (which fills the background of opaque components by default) to just call paint().
-
-
-
Field Detail
-
menuItem
protected javax.swing.JMenuItem menuItem
-
selectionBackground
protected java.awt.Color selectionBackground
-
selectionForeground
protected java.awt.Color selectionForeground
-
disabledForeground
protected java.awt.Color disabledForeground
-
acceleratorForeground
protected java.awt.Color acceleratorForeground
-
acceleratorSelectionForeground
protected java.awt.Color acceleratorSelectionForeground
-
defaultTextIconGap
protected int defaultTextIconGap
-
acceleratorFont
protected java.awt.Font acceleratorFont
-
mouseInputListener
protected javax.swing.event.MouseInputListener mouseInputListener
-
menuDragMouseListener
protected javax.swing.event.MenuDragMouseListener menuDragMouseListener
-
menuKeyListener
protected javax.swing.event.MenuKeyListener menuKeyListener
-
arrowIcon
protected javax.swing.Icon arrowIcon
-
checkIcon
protected javax.swing.Icon checkIcon
-
oldBorderPainted
protected boolean oldBorderPainted
-
_painter
protected ThemePainter _painter
-
-
Method Detail
-
createUI
public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
-
installUI
public void installUI(javax.swing.JComponent c)
- Overrides:
installUI
in classjavax.swing.plaf.ComponentUI
-
installDefaults
protected void installDefaults()
-
installComponents
protected void installComponents(javax.swing.JMenuItem menuItem)
- Since:
- 1.3
-
getPropertyPrefix
protected java.lang.String getPropertyPrefix()
-
installListeners
protected void installListeners()
-
installKeyboardActions
protected void installKeyboardActions()
-
uninstallUI
public void uninstallUI(javax.swing.JComponent c)
- Overrides:
uninstallUI
in classjavax.swing.plaf.ComponentUI
-
uninstallDefaults
protected void uninstallDefaults()
-
uninstallComponents
protected void uninstallComponents(javax.swing.JMenuItem menuItem)
- Since:
- 1.3
-
uninstallListeners
protected void uninstallListeners()
-
uninstallKeyboardActions
protected void uninstallKeyboardActions()
-
createMouseInputListener
protected javax.swing.event.MouseInputListener createMouseInputListener(javax.swing.JComponent c)
-
createMenuDragMouseListener
protected javax.swing.event.MenuDragMouseListener createMenuDragMouseListener(javax.swing.JComponent c)
-
createMenuKeyListener
protected javax.swing.event.MenuKeyListener createMenuKeyListener(javax.swing.JComponent c)
-
getActionMap
protected javax.swing.ActionMap getActionMap()
-
createActionMap
protected javax.swing.ActionMap createActionMap()
-
createInputMap
protected javax.swing.InputMap createInputMap(int condition)
-
getMinimumSize
public java.awt.Dimension getMinimumSize(javax.swing.JComponent c)
- Overrides:
getMinimumSize
in classjavax.swing.plaf.ComponentUI
-
getPreferredSize
public java.awt.Dimension getPreferredSize(javax.swing.JComponent c)
- Overrides:
getPreferredSize
in classjavax.swing.plaf.ComponentUI
-
getMaximumSize
public java.awt.Dimension getMaximumSize(javax.swing.JComponent c)
- Overrides:
getMaximumSize
in classjavax.swing.plaf.ComponentUI
-
getPreferredMenuItemSize
protected java.awt.Dimension getPreferredMenuItemSize(javax.swing.JComponent c, javax.swing.Icon checkIcon, javax.swing.Icon arrowIcon, int defaultTextIconGap)
-
update
public void update(java.awt.Graphics g, javax.swing.JComponent c)
We draw the background in paintMenuItem() so override update (which fills the background of opaque components by default) to just call paint().- Overrides:
update
in classjavax.swing.plaf.ComponentUI
-
paint
public void paint(java.awt.Graphics g, javax.swing.JComponent c)
- Overrides:
paint
in classjavax.swing.plaf.ComponentUI
-
paintMenuItem
protected void paintMenuItem(java.awt.Graphics g, javax.swing.JComponent c, javax.swing.Icon checkIcon, javax.swing.Icon arrowIcon, java.awt.Color background, java.awt.Color foreground, int defaultTextIconGap)
-
paintBackground
protected void paintBackground(java.awt.Graphics g, javax.swing.JMenuItem menuItem, java.awt.Color bgColor)
Draws the background of the menu item.- Parameters:
g
- the paint graphicsmenuItem
- menu item to be paintedbgColor
- selection background color- Since:
- 1.4
-
paintText
protected void paintText(java.awt.Graphics g, javax.swing.JMenuItem menuItem, java.awt.Rectangle textRect, java.lang.String text)
Renders the text of the current menu item.- Parameters:
g
- graphics contextmenuItem
- menu item to rendertextRect
- bounding rectangle for rendering the texttext
- string to render- Since:
- 1.4
-
getPath
public javax.swing.MenuElement[] getPath()
-
doClick
protected void doClick(javax.swing.MenuSelectionManager msm)
Call this method when a menu item is to be activated. This method handles some of the details of menu item activation such as clearing the selected path and messaging the JMenuItem's doClick() method.- Parameters:
msm
- A MenuSelectionManager. The visual feedback and internal bookkeeping tasks are delegated to this MenuSelectionManager. Ifnull
is passed as this argument, theMenuSelectionManager.defaultManager
is used.- Since:
- 1.4
- See Also:
MenuSelectionManager
,AbstractButton.doClick(int)
-
getPainter
public ThemePainter getPainter()
-
isDownArrowVisible
protected boolean isDownArrowVisible(java.awt.Container c)
-
getRightMargin
protected int getRightMargin()
-
-