public class UIBasicMenuItemUI
extends javax.swing.plaf.MenuItemUI
限定符和类型 | 类和说明 |
---|---|
static class |
UIBasicMenuItemUI.EmptyIcon |
protected class |
UIBasicMenuItemUI.MouseInputHandler |
限定符和类型 | 字段和说明 |
---|---|
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 static int |
defaultIconGap |
protected static 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 |
构造器和说明 |
---|
UIBasicMenuItemUI() |
限定符和类型 | 方法和说明 |
---|---|
protected javax.swing.event.MenuDragMouseListener |
createMenuDragMouseListener(javax.swing.JComponent c) |
protected javax.swing.event.MouseInputListener |
createMouseInputListener(javax.swing.JComponent c) |
static javax.swing.plaf.ComponentUI |
createUI(javax.swing.JComponent c)
创建UI
|
protected void |
doClick(javax.swing.MenuSelectionManager msm)
Call this method when a menu item is to be activated.
|
java.awt.Dimension |
getMaximumSize(javax.swing.JComponent c) |
java.awt.Dimension |
getMinimumSize(javax.swing.JComponent c) |
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 void |
installComponents(javax.swing.JMenuItem menuItem) |
protected void |
installDefaults() |
protected void |
installKeyboardActions() |
protected void |
installListeners() |
void |
installUI(javax.swing.JComponent c)
加载UI
|
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 one 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)
去除UI
|
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().
|
protected javax.swing.JMenuItem menuItem
protected java.awt.Color selectionBackground
protected java.awt.Color selectionForeground
protected java.awt.Color disabledForeground
protected java.awt.Color acceleratorForeground
protected java.awt.Color acceleratorSelectionForeground
protected static int defaultTextIconGap
protected static int defaultIconGap
protected java.awt.Font acceleratorFont
protected javax.swing.event.MouseInputListener mouseInputListener
protected javax.swing.event.MenuDragMouseListener menuDragMouseListener
protected javax.swing.event.MenuKeyListener menuKeyListener
protected javax.swing.Icon arrowIcon
protected javax.swing.Icon checkIcon
protected boolean oldBorderPainted
public void installUI(javax.swing.JComponent c)
installUI
在类中 javax.swing.plaf.ComponentUI
c
- 组件protected void installComponents(javax.swing.JMenuItem menuItem)
protected java.lang.String getPropertyPrefix()
protected void installListeners()
protected void installKeyboardActions()
public void uninstallUI(javax.swing.JComponent c)
uninstallUI
在类中 javax.swing.plaf.ComponentUI
c
- 组件protected void uninstallDefaults()
protected void uninstallComponents(javax.swing.JMenuItem menuItem)
protected void uninstallListeners()
protected void uninstallKeyboardActions()
protected javax.swing.event.MouseInputListener createMouseInputListener(javax.swing.JComponent c)
protected javax.swing.event.MenuDragMouseListener createMenuDragMouseListener(javax.swing.JComponent c)
public java.awt.Dimension getMinimumSize(javax.swing.JComponent c)
getMinimumSize
在类中 javax.swing.plaf.ComponentUI
public java.awt.Dimension getPreferredSize(javax.swing.JComponent c)
getPreferredSize
在类中 javax.swing.plaf.ComponentUI
protected void paintText(java.awt.Graphics g, javax.swing.JMenuItem menuItem, java.awt.Rectangle textRect, java.lang.String text)
g
- graphics contextmenuItem
- menu item to rendertextRect
- bounding rectangle for rendering the texttext
- string to renderpublic java.awt.Dimension getMaximumSize(javax.swing.JComponent c)
getMaximumSize
在类中 javax.swing.plaf.ComponentUI
public void update(java.awt.Graphics g, javax.swing.JComponent c)
update
在类中 javax.swing.plaf.ComponentUI
public void paint(java.awt.Graphics g, javax.swing.JComponent c)
paint
在类中 javax.swing.plaf.ComponentUI
public javax.swing.MenuElement[] getPath()
protected void doClick(javax.swing.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.MenuSelectionManager
,
AbstractButton.doClick(int)
public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
c
- 组件protected void installDefaults()
protected java.awt.Dimension getPreferredMenuItemSize(javax.swing.JComponent c, javax.swing.Icon checkIcon, javax.swing.Icon arrowIcon, int defaultTextIconGap)
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 paintBackground(java.awt.Graphics g, javax.swing.JMenuItem menuItem, java.awt.Color bgColor)
g
- the paint graphicsmenuItem
- menu item to be paintedbgColor
- unused