public abstract class AbstractMenuItemPainter<E extends javax.swing.JMenuItem,U extends javax.swing.plaf.basic.BasicMenuItemUI> extends AbstractPainter<E,U> implements IAbstractMenuItemPainter<E,U>, MenuCornerSupport
| Modifier and Type | Field and Description |
|---|---|
protected java.awt.Color |
acceleratorBg |
protected java.awt.Color |
acceleratorDisabledFg |
protected java.awt.Color |
acceleratorFg |
protected java.awt.Font |
acceleratorFont
Runtime variables.
|
protected int |
acceleratorGap
Style settings.
|
protected boolean |
alignTextToMenuIcons |
protected MenuItemChangeListener |
buttonModelChangeListener
Listeners.
|
protected java.awt.Color |
disabledFg |
protected int |
iconAlignment |
protected java.awt.Color |
selectedBottomBg |
protected java.awt.Color |
selectedTopBg |
component, listeners, ltr, propertyChangeListener, ui| Constructor and Description |
|---|
AbstractMenuItemPainter() |
| Modifier and Type | Method and Description |
|---|---|
void |
fillCorner(java.awt.Graphics2D g2d,
java.awt.Rectangle clip,
java.awt.Shape corner,
int cornerSide)
Asks to fill corner according to the selected element.
|
java.awt.Dimension |
getPreferredSize()
Returns preferred size required for proper painting of visual data provided by this painter.
|
java.awt.Rectangle |
getSelectedBounds()
Returns selected element bounds.
|
void |
install(E c,
U ui)
Called when painter is installed onto some component.
|
void |
paint(java.awt.Graphics2D g2d,
java.awt.Rectangle bounds,
E c,
U ui)
Paints visual data using component graphics context.
|
protected void |
paintAcceleratorText(java.awt.Graphics2D g2d,
java.lang.String accText,
java.awt.FontMetrics fm,
int x,
int y,
int w,
int h,
boolean selected)
Paints menu item accelerator text.
|
protected void |
paintBackground(java.awt.Graphics2D g2d,
boolean selected)
Paints menu item background.
|
protected void |
paintIcon(java.awt.Graphics2D g2d,
int x,
int y,
int w,
int h,
boolean selected)
Paints menu item icon.
|
protected void |
paintText(java.awt.Graphics2D g2d,
java.awt.FontMetrics fm,
int x,
int y,
int w,
int h,
boolean selected)
Paints menu item text.
|
protected void |
setAcceleratorFont()
Sets accelerator font.
|
void |
uninstall(E c,
U ui)
Called when painter is installed into some component.
|
addPainterListener, b, borderChange, getBorders, getCompleteBorder, i, i, i, installPropertyChangeListener, isOpaque, isSectionPainter, isSettingsUpdateAllowed, orientationChange, p, propertyChange, removePainterListener, repaint, repaint, repaint, revalidate, saveOrientation, uninstallPropertyChangeListener, updateAll, updateBorder, updateOpacity, updateOrientationclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddPainterListener, getBorders, isOpaque, removePainterListenerprotected int acceleratorGap
protected int iconAlignment
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 boolean alignTextToMenuIcons
protected MenuItemChangeListener buttonModelChangeListener
protected java.awt.Font acceleratorFont
public void install(E c, U ui)
Painterinstall in interface Painter<E extends javax.swing.JMenuItem,U extends javax.swing.plaf.basic.BasicMenuItemUI>install in class AbstractPainter<E extends javax.swing.JMenuItem,U extends javax.swing.plaf.basic.BasicMenuItemUI>c - component this painter is being installed ontoui - component UIpublic void uninstall(E c, U ui)
Painteruninstall in interface Painter<E extends javax.swing.JMenuItem,U extends javax.swing.plaf.basic.BasicMenuItemUI>uninstall in class AbstractPainter<E extends javax.swing.JMenuItem,U extends javax.swing.plaf.basic.BasicMenuItemUI>c - component this painter is being uninstalled fromui - component UIpublic void paint(java.awt.Graphics2D g2d,
java.awt.Rectangle bounds,
E c,
U ui)
PainterIt is highly recommended to honor provided painting bounds to avoid painting issues. These bounds might be representing full component size or contain just a small portion of the component.
protected void paintBackground(java.awt.Graphics2D g2d,
boolean selected)
g2d - graphics contextselected - whether menu item is selected or notprotected void paintIcon(java.awt.Graphics2D g2d,
int x,
int y,
int w,
int h,
boolean selected)
g2d - graphics contextx - icon placeholder X coordinatey - icon placeholder Y coordinatew - icon placeholder widthh - icon placeholder heightselected - whether menu item is selected or notprotected void paintText(java.awt.Graphics2D g2d,
java.awt.FontMetrics fm,
int x,
int y,
int w,
int h,
boolean selected)
g2d - graphics contextfm - text font metricsx - text X coordinatey - text rectangle Y coordinatew - text widthh - text rectangle heightselected - whether menu item is selected or notprotected void paintAcceleratorText(java.awt.Graphics2D g2d,
java.lang.String accText,
java.awt.FontMetrics fm,
int x,
int y,
int w,
int h,
boolean selected)
g2d - graphics contextaccText - 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 notprotected void setAcceleratorFont()
public java.awt.Rectangle getSelectedBounds()
MenuCornerSupportgetSelectedBounds in interface MenuCornerSupportpublic void fillCorner(java.awt.Graphics2D g2d,
java.awt.Rectangle clip,
java.awt.Shape corner,
int cornerSide)
MenuCornerSupportfillCorner in interface MenuCornerSupportg2d - graphics contextclip - preferred painting clipcorner - corner shapecornerSide - corner sidepublic java.awt.Dimension getPreferredSize()
PaintergetPreferredSize in interface Painter<E extends javax.swing.JMenuItem,U extends javax.swing.plaf.basic.BasicMenuItemUI>getPreferredSize in class AbstractPainter<E extends javax.swing.JMenuItem,U extends javax.swing.plaf.basic.BasicMenuItemUI>