JavaTM 2 Platform
Std. Ed. v1.3.1

javax.swing.plaf.basic
Class BasicMenuItemUI

java.lang.Object
  |
  +--javax.swing.plaf.ComponentUI
        |
        +--javax.swing.plaf.ButtonUI
              |
              +--javax.swing.plaf.MenuItemUI
                    |
                    +--javax.swing.plaf.basic.BasicMenuItemUI
Direct Known Subclasses:
BasicCheckBoxMenuItemUI, BasicMenuUI, BasicRadioButtonMenuItemUI

public class BasicMenuItemUI
extends MenuItemUI

BasicMenuItem implementation


Inner Class Summary
protected  class BasicMenuItemUI.MouseInputHandler
           
 
Field Summary
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 Summary
BasicMenuItemUI()
           
 
Method Summary
protected  MenuDragMouseListener createMenuDragMouseListener(JComponent c)
           
protected  MenuKeyListener createMenuKeyListener(JComponent c)
           
protected  MouseInputListener createMouseInputListener(JComponent c)
           
static ComponentUI createUI(JComponent c)
           
 Dimension getMaximumSize(JComponent c)
           
 Dimension getMinimumSize(JComponent c)
           
 MenuElement[] getPath()
           
protected  Dimension getPreferredMenuItemSize(JComponent c, Icon checkIcon, Icon arrowIcon, int defaultTextIconGap)
           
 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)
           
 void paint(Graphics g, JComponent c)
           
protected  void paintMenuItem(Graphics g, JComponent c, Icon checkIcon, Icon arrowIcon, Color background, Color foreground, int defaultTextIconGap)
           
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
 
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
Constructor Detail

BasicMenuItemUI

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

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 defaultTextIconGap)

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)

getPath

public MenuElement[] getPath()

JavaTM 2 Platform
Std. Ed. v1.3.1

Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2001 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.