| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public class BasicMenuItemUI extends MenuItemUI
BasicMenuItem implementation
Nested Class Summary | |
---|---|
protected class |
|
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 PropertyChangeListener |
propertyChangeListener
PropertyChangeListener returned from
createPropertyChangeListener . |
protected Color |
selectionBackground
|
protected Color |
selectionForeground
|
Constructor Summary | |
---|---|
|
Method Summary | |
---|---|
protected MenuDragMouseListener |
|
protected MenuKeyListener |
|
protected MouseInputListener |
|
protected PropertyChangeListener |
Creates a PropertyChangeListener which will be added to
the menu item.
|
static ComponentUI |
|
protected void |
Call this method when a menu item is to be activated. |
Dimension |
Returns the specified component's maximum size appropriate for the look and feel. |
Dimension |
Returns the specified component's minimum size appropriate for the look and feel. |
MenuElement[] |
getPath() |
protected Dimension |
getPreferredMenuItemSize(JComponent c, Icon checkIcon, Icon arrowIcon, int defaultTextIconGap) |
Dimension |
Returns the specified component's preferred size appropriate for the look and feel. |
protected String |
|
protected void |
installComponents(JMenuItem menuItem) |
protected void |
|
protected void |
|
protected void |
|
void |
Configures the specified component appropriate for the look and feel. |
void |
paint(Graphics g, JComponent c) Paints the specified component appropriate for the look and feel. |
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 |
Renders the text of the current menu item. |
protected void |
uninstallComponents(JMenuItem menuItem) |
protected void |
|
protected void |
|
protected void |
|
void |
Reverses configuration which was done on the specified component during installUI .
|
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, createUI, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, getPreferredSize, installUI, paint, uninstallUI, update |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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 PropertyChangeListener propertyChangeListener
PropertyChangeListener
returned from
createPropertyChangeListener
. You should not
need to access this field, rather if you want to customize the
PropertyChangeListener
override
createPropertyChangeListener
.
protected Color selectionBackground
protected Color selectionForeground
Constructor Detail |
---|
public BasicMenuItemUI()
Method Detail |
---|
protected MenuDragMouseListener createMenuDragMouseListener(JComponent c)
c
protected MenuKeyListener createMenuKeyListener(JComponent c)
c
protected MouseInputListener createMouseInputListener(JComponent c)
c
protected PropertyChangeListener createPropertyChangeListener(JComponent c)
PropertyChangeListener
which will be added to
the menu item.
If this method returns null then it will not be added to the menu item.
c
PropertyChangeListener
or nullpublic static ComponentUI createUI(JComponent c)
c
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.public Dimension getMaximumSize(JComponent c)
getMaximumSize
in class ComponentUI
c
public Dimension getMinimumSize(JComponent c)
getMinimumSize
in class ComponentUI
c
public MenuElement[] getPath()
protected Dimension getPreferredMenuItemSize(JComponent c, Icon checkIcon, Icon arrowIcon, int defaultTextIconGap)
c
checkIcon
arrowIcon
defaultTextIconGap
public Dimension getPreferredSize(JComponent c)
getPreferredSize
in class ComponentUI
c
protected String getPropertyPrefix()
protected void installComponents(JMenuItem menuItem)
menuItem
protected void installDefaults()
protected void installKeyboardActions()
protected void installListeners()
public void installUI(JComponent c)
installUI
in class ComponentUI
c
public void paint(Graphics g, JComponent c)
paint
in class ComponentUI
g
c
protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor)
g
- the paint graphicsmenuItem
- menu item to be paintedbgColor
- selection background colorprotected void paintMenuItem(Graphics g, JComponent c, Icon checkIcon, Icon arrowIcon, Color background, Color foreground, int defaultTextIconGap)
g
c
checkIcon
arrowIcon
background
foreground
defaultTextIconGap
protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text)
g
- graphics contextmenuItem
- menu item to rendertextRect
- bounding rectangle for rendering the texttext
- string to renderprotected void uninstallComponents(JMenuItem menuItem)
menuItem
protected void uninstallDefaults()
protected void uninstallKeyboardActions()
protected void uninstallListeners()
public void uninstallUI(JComponent c)
uninstallUI
in class ComponentUI
c
public void update(Graphics g, JComponent c)
update
in class ComponentUI
g
c
| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |