|
||||||||||
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 javax.swing.plaf.basic.BasicMenuUI com.alee.laf.menu.WebMenuUI
public class WebMenuUI
Custom UI for JMenu component.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicMenuUI |
---|
javax.swing.plaf.basic.BasicMenuUI.ChangeHandler, javax.swing.plaf.basic.BasicMenuUI.MouseInputHandler |
Field Summary | |
---|---|
protected boolean |
alignTextToMenuIcons
|
protected int |
arrowGap
|
static javax.swing.ImageIcon |
arrowLeftIcon
|
static javax.swing.ImageIcon |
arrowRightIcon
Used icons. |
protected MenuItemChangeListener |
buttonModelChangeListener
|
protected java.awt.Color |
disabledFg
|
protected int |
iconAlignment
|
protected java.awt.Insets |
margin
|
protected java.awt.event.MouseAdapter |
mouseAdapter
|
protected boolean |
mouseover
Runtime variables. |
protected Painter |
painter
|
protected java.beans.PropertyChangeListener |
propertyChangeListener
Menu listeners. |
protected int |
round
Style settings. |
protected java.awt.Color |
selectedBottomBg
|
protected java.awt.Color |
selectedTopBg
|
protected int |
shadeWidth
|
protected int |
sideSpacing
|
Fields inherited from class javax.swing.plaf.basic.BasicMenuUI |
---|
changeListener, menuListener |
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 | |
---|---|
WebMenuUI()
|
Method Summary | |
---|---|
static javax.swing.plaf.ComponentUI |
createUI(javax.swing.JComponent c)
Returns an instance of the WebMenuUI for the specified component. |
int |
getArrowGap()
Returns gap between menu icon/text and submenu arrow. |
protected javax.swing.Icon |
getArrowIcon(javax.swing.JMenu menu)
Returns arrow icon displayed when sub-menu is available. |
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. |
int |
getRound()
Returns top-level menu border rounding. |
java.awt.Color |
getSelectedBottomBg()
Returns bottom background color for selected item. |
java.awt.Color |
getSelectedTopBg()
Returns top background color for selected item. |
int |
getShadeWidth()
Returns top-level menu shade width. |
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 decoration. |
protected void |
paintBackground(java.awt.Graphics2D g2d,
javax.swing.JMenu menu,
boolean selected,
boolean ltr)
Paints menu item background. |
protected void |
paintIcon(java.awt.Graphics2D g2d,
javax.swing.JMenu menu,
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.JMenu menu,
java.awt.FontMetrics fm,
int x,
int y,
int w,
int h,
boolean selected,
boolean ltr)
Paints menu item text. |
void |
setAlignTextToMenuIcons(boolean align)
Sets whether should align all item texts to a single vertical line within single popup menu or not. |
void |
setArrowGap(int gap)
Sets gap between menu icon/text and submenu arrow. |
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 |
setRound(int round)
Sets top-level menu border rounding. |
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 |
setShadeWidth(int shadeWidth)
Sets top-level menu shade width. |
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.BasicMenuUI |
---|
createChangeListener, createMenuDragMouseListener, createMenuKeyListener, createMenuListener, createMouseInputListener, createPropertyChangeListener, getMaximumSize, getPropertyPrefix, installDefaults, installKeyboardActions, installListeners, setupPostTimer, uninstallDefaults, uninstallKeyboardActions, uninstallListeners |
Methods inherited from class javax.swing.plaf.basic.BasicMenuItemUI |
---|
doClick, getMinimumSize, getPath, getPreferredMenuItemSize, installComponents, paintBackground, paintMenuItem, paintText, uninstallComponents, 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 |
---|
public static final javax.swing.ImageIcon arrowRightIcon
public static final javax.swing.ImageIcon arrowLeftIcon
protected int round
protected int shadeWidth
protected java.awt.Insets margin
protected int sideSpacing
protected java.awt.Color disabledFg
protected java.awt.Color selectedTopBg
protected java.awt.Color selectedBottomBg
protected int arrowGap
protected boolean alignTextToMenuIcons
protected int iconAlignment
protected Painter painter
protected java.beans.PropertyChangeListener propertyChangeListener
protected java.awt.event.MouseAdapter mouseAdapter
protected MenuItemChangeListener buttonModelChangeListener
protected boolean mouseover
Constructor Detail |
---|
public WebMenuUI()
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 int getRound()
public void setRound(int round)
round
- new top-level menu border roundingpublic int getShadeWidth()
public void setShadeWidth(int shadeWidth)
shadeWidth
- new top-level menu shade widthpublic 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 int getArrowGap()
public void setArrowGap(int gap)
gap
- new gap between menu icon/text and submenu arrowpublic 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 componentprotected void paintBackground(java.awt.Graphics2D g2d, javax.swing.JMenu menu, boolean selected, boolean ltr)
g2d
- graphics contextmenu
- menuselected
- 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.JMenu menu, int x, int y, int w, int h, boolean selected, boolean ltr)
g2d
- graphics contextmenu
- menux
- 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.JMenu menu, java.awt.FontMetrics fm, int x, int y, int w, int h, boolean selected, boolean ltr)
g2d
- graphics contextmenu
- menufm
- 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 javax.swing.Icon getArrowIcon(javax.swing.JMenu menu)
public 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 |