JIDE 3.5.15

com.jidesoft.plaf.eclipse
Class EclipseMenuItemUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by javax.swing.plaf.ButtonUI
          extended by javax.swing.plaf.MenuItemUI
              extended by com.jidesoft.plaf.eclipse.EclipseMenuItemUI
Direct Known Subclasses:
EclipseCheckBoxMenuItemUI, EclipseMenuUI, EclipseRadioButtonMenuItemUI

public class EclipseMenuItemUI
extends MenuItemUI

MenuItem UI implementation


Nested Class Summary
protected  class EclipseMenuItemUI.MouseInputHandler
           
 
Field Summary
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 Summary
EclipseMenuItemUI()
           
 
Method Summary
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 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().
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

menuItem

protected JMenuItem menuItem

selectionBackground

protected Color selectionBackground

selectionForeground

protected Color selectionForeground

disabledForeground

protected Color disabledForeground

acceleratorForeground

protected Color acceleratorForeground

acceleratorSelectionForeground

protected Color acceleratorSelectionForeground

defaultTextIconGap

protected int defaultTextIconGap

acceleratorFont

protected Font acceleratorFont

mouseInputListener

protected MouseInputListener mouseInputListener

menuDragMouseListener

protected MenuDragMouseListener menuDragMouseListener

menuKeyListener

protected MenuKeyListener menuKeyListener

arrowIcon

protected Icon arrowIcon

checkIcon

protected Icon checkIcon

oldBorderPainted

protected boolean oldBorderPainted

shadowColor

protected Color shadowColor

defaultAccelEndGap

protected int defaultAccelEndGap

defaultShadowWidth

protected int defaultShadowWidth

_painter

protected ThemePainter _painter
Constructor Detail

EclipseMenuItemUI

public EclipseMenuItemUI()
Method Detail

createUI

public static ComponentUI createUI(JComponent c)

installUI

public void installUI(JComponent c)
Overrides:
installUI in class ComponentUI

installDefaults

protected void installDefaults()

installComponents

protected void installComponents(JMenuItem menuItem)
Parameters:
menuItem - the menu item
Since:
1.3

getPropertyPrefix

protected String getPropertyPrefix()

installListeners

protected void installListeners()

installKeyboardActions

protected void installKeyboardActions()

uninstallUI

public void uninstallUI(JComponent c)
Overrides:
uninstallUI in class ComponentUI

uninstallDefaults

protected void uninstallDefaults()

uninstallComponents

protected void uninstallComponents(JMenuItem menuItem)
Parameters:
menuItem - the menu item
Since:
1.3

uninstallListeners

protected void uninstallListeners()

uninstallKeyboardActions

protected void uninstallKeyboardActions()

createMouseInputListener

protected MouseInputListener createMouseInputListener(JComponent c)

createMenuDragMouseListener

protected MenuDragMouseListener createMenuDragMouseListener(JComponent c)

createMenuKeyListener

protected MenuKeyListener createMenuKeyListener(JComponent c)

getActionMap

protected ActionMap getActionMap()

createActionMap

protected ActionMap createActionMap()

createInputMap

protected InputMap createInputMap(int condition)

getMinimumSize

public Dimension getMinimumSize(JComponent c)
Overrides:
getMinimumSize in class ComponentUI

getPreferredSize

public Dimension getPreferredSize(JComponent c)
Overrides:
getPreferredSize in class ComponentUI

getMaximumSize

public Dimension getMaximumSize(JComponent c)
Overrides:
getMaximumSize in class ComponentUI

getPreferredMenuItemSize

protected Dimension getPreferredMenuItemSize(JComponent c,
                                             Icon checkIcon,
                                             Icon arrowIcon,
                                             int textIconGap)

update

public 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().

Overrides:
update in class ComponentUI

paint

public void paint(Graphics g,
                  JComponent c)
Overrides:
paint in class ComponentUI

paintMenuItem

protected void paintMenuItem(Graphics g,
                             JComponent c,
                             Icon checkIcon,
                             Icon arrowIcon,
                             Color background,
                             Color foreground,
                             int defaultTextIconGap)

paintBackground

protected void paintBackground(Graphics g,
                               JMenuItem menuItem,
                               Color bgColor)
Draws the background of the menu item.

Parameters:
g - the paint graphics
menuItem - menu item to be painted
bgColor - selection background color
Since:
1.4

paintText

protected void paintText(Graphics g,
                         JMenuItem menuItem,
                         Rectangle textRect,
                         String text)
Method which renders the text of the current menu item.

Parameters:
g - Graphics context
menuItem - Current menu item to render
textRect - Bounding rectangle to render the text.
text - String to render

getPath

public MenuElement[] getPath()

doClick

protected void doClick(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. If null is passed as this argument, the MenuSelectionManager.defaultManager is used.
Since:
1.4
See Also:
MenuSelectionManager, AbstractButton.doClick(int)

getPainter

public ThemePainter getPainter()

isDownArrowVisible

protected boolean isDownArrowVisible(Container c)

JIDE 3.5.15