|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.plaf.ComponentUI javax.swing.plaf.ButtonUI javax.swing.plaf.MenuItemUI javax.swing.plaf.basic.BasicMenuItemUI com.alee.laf.menu.WebMenuItemUI
public class WebMenuItemUI
Custom UI for JMenuItem component.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicMenuItemUI |
---|
javax.swing.plaf.basic.BasicMenuItemUI.MouseInputHandler |
Field Summary | |
---|---|
protected java.awt.Color |
acceleratorBg
|
protected java.awt.Color |
acceleratorDisabledFg
|
protected java.awt.Color |
acceleratorFg
|
protected int |
acceleratorGap
|
protected boolean |
alignTextToMenuIcons
|
protected MenuItemChangeListener |
buttonModelChangeListener
|
protected java.awt.Color |
disabledFg
|
protected int |
iconAlignment
|
protected java.awt.Insets |
margin
Style settings. |
protected Painter |
painter
|
protected java.beans.PropertyChangeListener |
propertyChangeListener
Menu item listeners. |
protected java.awt.Color |
selectedBottomBg
|
protected java.awt.Color |
selectedTopBg
|
protected int |
sideSpacing
|
Fields inherited from class javax.swing.plaf.basic.BasicMenuItemUI |
---|
acceleratorFont, acceleratorForeground, acceleratorSelectionForeground, arrowIcon, checkIcon, defaultTextIconGap, disabledForeground, menuDragMouseListener, menuItem, menuKeyListener, mouseInputListener, oldBorderPainted, selectionBackground, selectionForeground |
Constructor Summary | |
---|---|
WebMenuItemUI()
|
Method Summary | |
---|---|
static javax.swing.plaf.ComponentUI |
createUI(javax.swing.JComponent c)
Returns an instance of the WebMenuItemUI for the specified component. |
java.awt.Color |
getAcceleratorBg()
Returns accelerator text background. |
java.awt.Color |
getAcceleratorDisabledFg()
Returns disabled accelerator foreground. |
java.awt.Color |
getAcceleratorFg()
Returns accelerator foreground. |
int |
getAcceleratorGap()
Returns gap between menu item icon/text and accelerator. |
java.awt.Color |
getDisabledFg()
Returns disabled menu item foreground. |
int |
getIconAlignment()
Returns icon alignment. |
java.awt.Insets |
getMargin()
Returns menu item margin. |
java.awt.Paint |
getNorthCornerFill()
Returns paint used to fill north popup menu corner when this component is first in the menu. |
Painter |
getPainter()
Returns menu item painter. |
java.awt.Dimension |
getPreferredSize(javax.swing.JComponent c)
Returns menu item preferred size. |
java.awt.Color |
getSelectedBottomBg()
Returns bottom background color for selected item. |
java.awt.Color |
getSelectedTopBg()
Returns top background color for selected item. |
int |
getSideSpacing()
Returns spacing between menu item content and its left/right borders. |
java.awt.Paint |
getSouthCornerFill()
Returns paint used to fill south popup menu corner when this component is last in the menu. |
void |
installUI(javax.swing.JComponent c)
Installs UI in the specified component. |
boolean |
isAlignTextToMenuIcons()
Returns whether should align all item texts to a single vertical line within single popup menu or not. |
void |
paint(java.awt.Graphics g,
javax.swing.JComponent c)
Paints menu item decoration. |
protected void |
paintAcceleratorText(java.awt.Graphics2D g2d,
javax.swing.JMenuItem menuItem,
java.lang.String accText,
java.awt.FontMetrics fm,
int x,
int y,
int w,
int h,
boolean selected,
boolean ltr)
Paints menu item accelerator text. |
protected void |
paintBackground(java.awt.Graphics2D g2d,
javax.swing.JMenuItem menuItem,
int x,
int y,
int w,
int h,
boolean selected,
boolean ltr)
Paints menu item background. |
protected void |
paintIcon(java.awt.Graphics2D g2d,
javax.swing.JMenuItem menuItem,
int x,
int y,
int w,
int h,
boolean selected,
boolean ltr)
Paints menu item icon. |
protected void |
paintText(java.awt.Graphics2D g2d,
javax.swing.JMenuItem menuItem,
java.awt.FontMetrics fm,
int x,
int y,
int w,
int h,
boolean selected,
boolean ltr)
Paints menu item text. |
void |
setAcceleratorBg(java.awt.Color background)
Sets accelerator text background. |
void |
setAcceleratorDisabledFg(java.awt.Color foreground)
Sets disabled accelerator foreground. |
void |
setAcceleratorFg(java.awt.Color foreground)
Sets accelerator foreground. |
void |
setAcceleratorGap(int gap)
Sets gap between menu icon/text and accelerator. |
void |
setAlignTextToMenuIcons(boolean align)
Sets whether should align all item texts to a single vertical line within single popup menu or not. |
void |
setDisabledFg(java.awt.Color foreground)
Sets disabled menu item foreground. |
void |
setIconAlignment(int alignment)
Sets icon alignment |
void |
setMargin(java.awt.Insets margin)
Sets menu item margin. |
void |
setPainter(Painter painter)
Sets menu item painter. |
void |
setSelectedBottomBg(java.awt.Color background)
Sets bottom background color for selected item. |
void |
setSelectedTopBg(java.awt.Color background)
Sets top background color for selected item. |
void |
setSideSpacing(int sideSpacing)
Sets spacing between menu item content and its left/right borders |
void |
uninstallUI(javax.swing.JComponent c)
Uninstalls UI from the specified component. |
void |
updateBorder()
Updates custom WebLaF border. |
Methods inherited from class javax.swing.plaf.basic.BasicMenuItemUI |
---|
createMenuDragMouseListener, createMenuKeyListener, createMouseInputListener, createPropertyChangeListener, doClick, getMaximumSize, getMinimumSize, getPath, getPreferredMenuItemSize, getPropertyPrefix, installComponents, installDefaults, installKeyboardActions, installListeners, paintBackground, paintMenuItem, paintText, uninstallComponents, uninstallDefaults, uninstallKeyboardActions, uninstallListeners, update |
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 java.awt.Insets margin
protected int sideSpacing
protected java.awt.Color disabledFg
protected java.awt.Color selectedTopBg
protected java.awt.Color selectedBottomBg
protected java.awt.Color acceleratorBg
protected java.awt.Color acceleratorFg
protected java.awt.Color acceleratorDisabledFg
protected int acceleratorGap
protected boolean alignTextToMenuIcons
protected int iconAlignment
protected Painter painter
protected java.beans.PropertyChangeListener propertyChangeListener
protected MenuItemChangeListener buttonModelChangeListener
Constructor Detail |
---|
public WebMenuItemUI()
Method Detail |
---|
public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
c
- component that will use UI instance
public void installUI(javax.swing.JComponent c)
installUI
in class javax.swing.plaf.basic.BasicMenuItemUI
c
- component for this UIpublic void uninstallUI(javax.swing.JComponent c)
uninstallUI
in class javax.swing.plaf.basic.BasicMenuItemUI
c
- component with this UIpublic void updateBorder()
updateBorder
in interface BorderMethods
public java.awt.Insets getMargin()
public void setMargin(java.awt.Insets margin)
margin
- new menu item marginpublic int getSideSpacing()
public void setSideSpacing(int sideSpacing)
sideSpacing
- spacing between menu item content and its left/right borderspublic java.awt.Color getDisabledFg()
public void setDisabledFg(java.awt.Color foreground)
foreground
- new disabled menu item foregroundpublic java.awt.Color getSelectedTopBg()
public void setSelectedTopBg(java.awt.Color background)
background
- new top background color for selected itempublic java.awt.Color getSelectedBottomBg()
public void setSelectedBottomBg(java.awt.Color background)
background
- new bottom background color for selected itempublic java.awt.Color getAcceleratorBg()
public void setAcceleratorBg(java.awt.Color background)
background
- new accelerator text backgroundpublic java.awt.Color getAcceleratorFg()
public void setAcceleratorFg(java.awt.Color foreground)
foreground
- new accelerator foregroundpublic java.awt.Color getAcceleratorDisabledFg()
public void setAcceleratorDisabledFg(java.awt.Color foreground)
foreground
- new disabled accelerator foregroundpublic int getAcceleratorGap()
public void setAcceleratorGap(int gap)
gap
- new gap between menu icon/text and acceleratorpublic boolean isAlignTextToMenuIcons()
public void setAlignTextToMenuIcons(boolean align)
align
- whether should align all item texts to a single vertical line within single popup menu or notpublic int getIconAlignment()
public void setIconAlignment(int alignment)
alignment
- new icon alignmentpublic Painter getPainter()
public void setPainter(Painter painter)
painter
- new menu item painterpublic java.awt.Paint getNorthCornerFill()
public java.awt.Paint getSouthCornerFill()
public void paint(java.awt.Graphics g, javax.swing.JComponent c)
paint
in class javax.swing.plaf.basic.BasicMenuItemUI
g
- graphics contextc
- menu item componentprotected void paintBackground(java.awt.Graphics2D g2d, javax.swing.JMenuItem menuItem, int x, int y, int w, int h, boolean selected, boolean ltr)
g2d
- graphics contextmenuItem
- menu itemx
- icon placeholder X coordinatey
- icon placeholder Y coordinatew
- icon placeholder widthh
- icon placeholder heightselected
- whether menu item is selected or notltr
- whether menu item has left-to-right orientation or notprotected void paintIcon(java.awt.Graphics2D g2d, javax.swing.JMenuItem menuItem, int x, int y, int w, int h, boolean selected, boolean ltr)
g2d
- graphics contextmenuItem
- menu itemx
- icon placeholder X coordinatey
- icon placeholder Y coordinatew
- icon placeholder widthh
- icon placeholder heightselected
- whether menu item is selected or notltr
- whether menu item has left-to-right orientation or notprotected void paintText(java.awt.Graphics2D g2d, javax.swing.JMenuItem menuItem, java.awt.FontMetrics fm, int x, int y, int w, int h, boolean selected, boolean ltr)
g2d
- graphics contextmenuItem
- menu itemfm
- text font metricsx
- text X coordinatey
- text rectangle Y coordinatew
- text widthh
- text rectangle heightselected
- whether menu item is selected or notltr
- whether menu item has left-to-right orientation or notprotected void paintAcceleratorText(java.awt.Graphics2D g2d, javax.swing.JMenuItem menuItem, java.lang.String accText, java.awt.FontMetrics fm, int x, int y, int w, int h, boolean selected, boolean ltr)
g2d
- graphics contextmenuItem
- menu itemaccText
- accelerator textfm
- accelerator text font metricsx
- accelerator text X coordinatey
- accelerator text rectangle Y coordinatew
- accelerator text widthh
- accelerator text rectangle heightselected
- whether menu item is selected or notltr
- whether menu item has left-to-right orientation or notpublic java.awt.Dimension getPreferredSize(javax.swing.JComponent c)
getPreferredSize
in class javax.swing.plaf.basic.BasicMenuItemUI
c
- menu item component
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |