|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.swing.plaf.ComponentUI
javax.swing.plaf.ButtonUI
javax.swing.plaf.MenuItemUI
de.muntjak.tinylookandfeel.TinyMenuItemUI
public class TinyMenuItemUI
Tiny MenuItemUI implementation.
| Nested Class Summary | |
|---|---|
protected class |
TinyMenuItemUI.MouseInputHandler
|
| Field Summary | |
|---|---|
protected java.awt.Font |
acceleratorFont
|
protected java.awt.Color |
acceleratorForeground
|
protected static java.awt.Rectangle |
acceleratorRect
|
protected java.awt.Color |
acceleratorSelectionForeground
|
protected javax.swing.Icon |
arrowIcon
|
protected static java.awt.Rectangle |
arrowIconRect
|
protected javax.swing.Icon |
checkIcon
|
protected static java.awt.Rectangle |
checkIconRect
|
protected java.awt.Color |
disabledForeground
|
protected static java.awt.Rectangle |
iconRect
|
static java.lang.String |
MAX_ACC_WIDTH
|
static java.lang.String |
MAX_ICON_WIDTH
|
static java.lang.String |
MAX_LABEL_WIDTH
|
static java.lang.String |
MAX_TEXT_WIDTH
Client property keys |
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 static java.awt.Rectangle |
rect
|
protected java.awt.Color |
selectionBackground
|
protected java.awt.Color |
selectionForeground
|
protected static java.awt.Rectangle |
textRect
|
protected static java.awt.Rectangle |
viewRect
|
protected static java.awt.Rectangle |
zeroRect
|
| Constructor Summary | |
|---|---|
TinyMenuItemUI()
|
|
| Method Summary | |
|---|---|
protected javax.swing.event.MenuDragMouseListener |
createMenuDragMouseListener(javax.swing.JComponent c)
|
protected javax.swing.event.MouseInputListener |
createMouseInputListener(javax.swing.JComponent c)
|
protected java.beans.PropertyChangeListener |
createPropertyChangeListener(javax.swing.JComponent c)
|
static javax.swing.plaf.ComponentUI |
createUI(javax.swing.JComponent c)
|
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 |
getPreferredMenuItemSizeOneIcon(javax.swing.JComponent c,
javax.swing.Icon checkIcon,
javax.swing.Icon arrowIcon)
Calculate and return the preferred size of a menu item. |
protected java.awt.Dimension |
getPreferredMenuItemSizeTwoIcons(javax.swing.JComponent c,
javax.swing.Icon checkIcon,
javax.swing.Icon arrowIcon)
Calculate and return the preferred size of a menu item. |
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)
|
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,
boolean isLeftToRight)
Draws the background of one menu item. |
protected void |
paintMenuItemOneIcon(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 iconGap)
|
protected void |
paintMenuItemTwoIcons(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 iconGap)
|
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)
|
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(). |
| 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 |
|---|
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 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 static final java.lang.String MAX_TEXT_WIDTH
public static final java.lang.String MAX_ICON_WIDTH
public static final java.lang.String MAX_LABEL_WIDTH
public static final java.lang.String MAX_ACC_WIDTH
protected static java.awt.Rectangle zeroRect
protected static java.awt.Rectangle iconRect
protected static java.awt.Rectangle textRect
protected static java.awt.Rectangle acceleratorRect
protected static java.awt.Rectangle checkIconRect
protected static java.awt.Rectangle arrowIconRect
protected static java.awt.Rectangle viewRect
protected static java.awt.Rectangle rect
| Constructor Detail |
|---|
public TinyMenuItemUI()
| Method Detail |
|---|
public void installUI(javax.swing.JComponent c)
installUI in class javax.swing.plaf.ComponentUIprotected 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 in class javax.swing.plaf.ComponentUIprotected 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)
protected java.beans.PropertyChangeListener createPropertyChangeListener(javax.swing.JComponent c)
public java.awt.Dimension getMinimumSize(javax.swing.JComponent c)
getMinimumSize in class javax.swing.plaf.ComponentUIpublic java.awt.Dimension getPreferredSize(javax.swing.JComponent c)
getPreferredSize in class 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 in class javax.swing.plaf.ComponentUI
public void update(java.awt.Graphics g,
javax.swing.JComponent c)
update in class javax.swing.plaf.ComponentUI
public void paint(java.awt.Graphics g,
javax.swing.JComponent c)
paint in class javax.swing.plaf.ComponentUIpublic 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)
protected void installDefaults()
protected java.awt.Dimension getPreferredMenuItemSizeTwoIcons(javax.swing.JComponent c,
javax.swing.Icon checkIcon,
javax.swing.Icon arrowIcon)
c - checkIcon - arrowIcon -
protected java.awt.Dimension getPreferredMenuItemSizeOneIcon(javax.swing.JComponent c,
javax.swing.Icon checkIcon,
javax.swing.Icon arrowIcon)
c - checkIcon - arrowIcon -
protected void paintMenuItemTwoIcons(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 iconGap)
protected void paintMenuItemOneIcon(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 iconGap)
protected void paintBackground(java.awt.Graphics g,
javax.swing.JMenuItem menuItem,
java.awt.Color bgColor,
boolean isLeftToRight)
g - the paint graphicsmenuItem - menu item to be paintedbgColor - unused
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||