JIDE 3.5.15

com.jidesoft.plaf.vsnet
Class VsnetMenuItemUI

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.vsnet.VsnetMenuItemUI
Direct Known Subclasses:
MetalRadioButtonMenuItemUI, VsnetCheckBoxMenuItemUI, VsnetMenuUI, VsnetRadioButtonMenuItemUI

public class VsnetMenuItemUI
extends MenuItemUI

MenuItem UI implementation


Nested Class Summary
protected  class VsnetMenuItemUI.MouseInputHandler
           
 
Field Summary
protected  boolean _isFloatingIcon
           
protected  Font acceleratorFont
           
protected  Color acceleratorForeground
           
protected static Rectangle acceleratorRect
           
protected  Color acceleratorSelectionForeground
           
protected  Icon arrowIcon
           
protected static Rectangle arrowIconRect
           
protected  Color backgroundColor
           
protected  Color borderColor
           
protected  Icon checkIcon
           
protected static Rectangle checkIconRect
           
protected  int defaultAccelEndGap
           
protected  int defaultShadowWidth
           
protected  int defaultTextIconGap
           
protected  Color disabledForeground
           
protected static Rectangle iconRect
           
protected  MenuDragMouseListener menuDragMouseListener
           
protected  JMenuItem menuItem
           
protected  MenuKeyListener menuKeyListener
           
protected  MouseInputListener mouseInputListener
           
protected  boolean oldBorderPainted
           
protected  Color selectionBackground
           
protected  Color selectionForeground
           
protected  Color shadowColor
           
protected static Rectangle textRect
           
protected static Rectangle viewRect
           
protected  InputMap windowInputMap
          Used for accelerator binding, lazily created.
protected static Rectangle zeroRect
           
 
Constructor Summary
VsnetMenuItemUI()
           
 
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()
           
protected  Icon getIcon(AbstractButton b)
           
 Dimension getMaximumSize(JComponent c)
           
 Dimension getMinimumSize(JComponent c)
           
protected  ThemePainter getPainter()
           
 MenuElement[] getPath()
           
protected  Dimension getPreferredMenuItemSize(JComponent c, Icon checkIcon, Icon arrowIcon, int textIconGap)
           
 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)
           
protected  boolean isFloatingIcon()
           
 void paint(Graphics g, JComponent c)
           
protected  void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor)
          Draws the background of the menu item.
protected  void paintCheckBox(JMenuItem b, Graphics g, Icon checkIcon)
           
protected  void paintIcon(JMenuItem b, Graphics g)
           
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().
protected  boolean useCheckAndArrow()
           
 
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

windowInputMap

protected InputMap windowInputMap
Used for accelerator binding, lazily created.


shadowColor

protected Color shadowColor

defaultAccelEndGap

protected int defaultAccelEndGap

defaultShadowWidth

protected int defaultShadowWidth

borderColor

protected Color borderColor

backgroundColor

protected Color backgroundColor

_isFloatingIcon

protected boolean _isFloatingIcon

zeroRect

protected static Rectangle zeroRect

iconRect

protected static Rectangle iconRect

textRect

protected static Rectangle textRect

acceleratorRect

protected static Rectangle acceleratorRect

checkIconRect

protected static Rectangle checkIconRect

arrowIconRect

protected static Rectangle arrowIconRect

viewRect

protected static Rectangle viewRect
Constructor Detail

VsnetMenuItemUI

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

paintCheckBox

protected void paintCheckBox(JMenuItem b,
                             Graphics g,
                             Icon checkIcon)

paintIcon

protected void paintIcon(JMenuItem b,
                         Graphics g)

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

useCheckAndArrow

protected boolean useCheckAndArrow()

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

protected ThemePainter getPainter()

isDownArrowVisible

protected boolean isDownArrowVisible(Container c)

isFloatingIcon

protected boolean isFloatingIcon()

getIcon

protected Icon getIcon(AbstractButton b)

getRightMargin

protected int getRightMargin()

JIDE 3.5.15