Class FlatMenuItemRenderer
java.lang.Object
com.formdev.flatlaf.ui.FlatMenuItemRenderer
- Direct Known Subclasses:
FlatMenuUI.FlatMenuRenderer
Renderer for menu items.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected final Stringprotected Fontprotected Iconprivate KeyStrokeprivate booleanprivate Stringprotected Colorprotected Iconprotected Insetsprivate static final charprivate static final charprivate booleanprivate static final Stringprivate final Fontprotected final JMenuItemprotected Dimensionprotected intprivate static final charprotected intprotected Insetsprivate static final charprotected intprotected intprotected Colorprotected Colorprotected Colorprotected intprotected boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ObjectapplyStyleProperty(String key, Object value) private static intcenterOffset(int wh1, int wh2) (package private) static voidprotected ColorderiveBackground(Color background) private Stringprivate Iconprivate Iconprotected StringgetMacOSModifiersExText(int modifiers, boolean leftToRight) private intCalculates the maximum width of all menu item icons in the popup.protected DimensiongetStyleableValue(String key) protected StringgetTextForAccelerator(KeyStroke accelerator) private Fontprotected static booleanisArmedOrSelected(JMenuItem menuItem) Returnstrueif either the menu item is armed (mouse over item) or it is aJMenuand selected (shows submenu).static booleanisInVerticalMenuBar(JMenuItem menuItem) protected static booleanisTopLevelMenu(JMenuItem menuItem) protected booleanprivate voidlayout(Rectangle viewRect, Rectangle iconRect, Rectangle textRect, Rectangle accelRect, Rectangle arrowRect, Rectangle labelRect) protected voidpaintAccelerator(Graphics g, Rectangle accelRect, String accelText, Color foreground, Color selectionForeground, Color disabledForeground) protected voidpaintArrowIcon(Graphics g, Rectangle arrowRect, Icon arrowIcon) protected voidprotected static voidpaintHTMLText(Graphics g, JMenuItem menuItem, Rectangle textRect, View htmlView, Color selectionForeground) protected voidpaintIcon(Graphics g, Rectangle iconRect, Icon icon, Color checkBackground, Color selectionBackground) protected static voidprotected voidpaintMenuItem(Graphics g, Color selectionBackground, Color selectionForeground, Color disabledForeground, Color acceleratorForeground, Color acceleratorSelectionForeground) protected voidpaintSelection(Graphics g, Color selectionBackground, Insets selectionInsets, int selectionArc) protected voidpaintText(Graphics g, Rectangle textRect, String text, Color selectionForeground, Color disabledForeground) protected static voidpaintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text, int mnemonicIndex, Font font, Color foreground, Color selectionForeground, Color disabledForeground) protected voidpaintUnderlineSelection(Graphics g, Color underlineSelectionBackground, Color underlineSelectionColor, int underlineSelectionHeight)
-
Field Details
-
KEY_MAX_ICONS_WIDTH
- See Also:
-
checkIcon
-
arrowIcon
-
acceleratorFont
-
acceleratorDelimiter
-
verticallyAlignText
protected boolean verticallyAlignText- Since:
- 2
-
minimumWidth
protected int minimumWidth -
minimumIconSize
-
textAcceleratorGap
protected int textAcceleratorGap -
textNoAcceleratorGap
protected int textNoAcceleratorGap -
acceleratorArrowGap
protected int acceleratorArrowGap -
checkBackground
-
checkMargins
-
selectionInsets
- Since:
- 3
-
selectionArc
protected int selectionArc- Since:
- 3
-
underlineSelectionBackground
-
underlineSelectionCheckBackground
-
underlineSelectionColor
-
underlineSelectionHeight
protected int underlineSelectionHeight -
cachedAccelerator
-
cachedAcceleratorText
-
cachedAcceleratorLeftToRight
private boolean cachedAcceleratorLeftToRight -
controlGlyph
private static final char controlGlyph- See Also:
-
optionGlyph
private static final char optionGlyph- See Also:
-
shiftGlyph
private static final char shiftGlyph- See Also:
-
commandGlyph
private static final char commandGlyph- See Also:
-
-
Constructor Details
-
FlatMenuItemRenderer
-
-
Method Details
-
applyStyleProperty
-
getStyleableInfos
-
getStyleableValue
-
getPreferredMenuItemSize
-
layout
-
centerOffset
private static int centerOffset(int wh1, int wh2) -
paintMenuItem
-
paintBackground
- Since:
- 3
-
paintSelection
-
paintUnderlineSelection
-
deriveBackground
-
paintIcon
-
paintText
-
paintAccelerator
-
paintArrowIcon
-
paintIcon
-
paintText
-
paintHTMLText
-
isArmedOrSelected
Returnstrueif either the menu item is armed (mouse over item) or it is aJMenuand selected (shows submenu). -
isTopLevelMenu
-
isInVerticalMenuBar
- Since:
- 3.5
-
isUnderlineSelection
protected boolean isUnderlineSelection() -
getTopLevelFont
-
getIconForPainting
-
getIconForLayout
-
getAcceleratorText
-
getTextForAccelerator
-
getMacOSModifiersExText
-
getMaxIconsWidth
private int getMaxIconsWidth()Calculates the maximum width of all menu item icons in the popup. -
clearClientProperties
-