Package com.formdev.flatlaf.ui
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 class
private class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
protected final String
protected Font
protected Icon
private KeyStroke
private boolean
private String
protected Color
protected Icon
protected Insets
private static final char
private static final char
private boolean
private static final String
private final Font
protected final JMenuItem
protected Dimension
protected int
private static final char
protected int
protected Insets
private static final char
protected int
protected int
protected Color
protected Color
protected Color
protected int
protected boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Object
applyStyleProperty
(String key, Object value) private static int
centerOffset
(int wh1, int wh2) (package private) static void
protected Color
deriveBackground
(Color background) private String
private Icon
private Icon
protected String
getMacOSModifiersExText
(int modifiers, boolean leftToRight) private int
Calculates the maximum width of all menu item icons in the popup.protected Dimension
getStyleableValue
(String key) protected String
getTextForAccelerator
(KeyStroke accelerator) private Font
protected static boolean
isArmedOrSelected
(JMenuItem menuItem) Returnstrue
if either the menu item is armed (mouse over item) or it is aJMenu
and selected (shows submenu).static boolean
isInVerticalMenuBar
(JMenuItem menuItem) protected static boolean
isTopLevelMenu
(JMenuItem menuItem) protected boolean
private void
layout
(Rectangle viewRect, Rectangle iconRect, Rectangle textRect, Rectangle accelRect, Rectangle arrowRect, Rectangle labelRect) protected void
paintAccelerator
(Graphics g, Rectangle accelRect, String accelText, Color foreground, Color selectionForeground, Color disabledForeground) protected void
paintArrowIcon
(Graphics g, Rectangle arrowRect, Icon arrowIcon) protected void
protected static void
paintHTMLText
(Graphics g, JMenuItem menuItem, Rectangle textRect, View htmlView, Color selectionForeground) protected void
paintIcon
(Graphics g, Rectangle iconRect, Icon icon, Color checkBackground, Color selectionBackground) protected static void
protected void
paintMenuItem
(Graphics g, Color selectionBackground, Color selectionForeground, Color disabledForeground, Color acceleratorForeground, Color acceleratorSelectionForeground) protected void
paintSelection
(Graphics g, Color selectionBackground, Insets selectionInsets, int selectionArc) protected void
paintText
(Graphics g, Rectangle textRect, String text, Color selectionForeground, Color disabledForeground) protected static void
paintText
(Graphics g, JMenuItem menuItem, Rectangle textRect, String text, int mnemonicIndex, Font font, Color foreground, Color selectionForeground, Color disabledForeground) protected void
paintUnderlineSelection
(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
- Since:
- 2
-
getStyleableInfos
- Since:
- 2
-
getStyleableValue
- Since:
- 2.5
-
getPreferredMenuItemSize
-
layout
-
centerOffset
private static int centerOffset(int wh1, int wh2) -
paintMenuItem
-
paintBackground
- Since:
- 3
-
paintSelection
protected void paintSelection(Graphics g, Color selectionBackground, Insets selectionInsets, int selectionArc) - Since:
- 3
-
paintUnderlineSelection
protected void paintUnderlineSelection(Graphics g, Color underlineSelectionBackground, Color underlineSelectionColor, int underlineSelectionHeight) - Since:
- 3
-
deriveBackground
-
paintIcon
-
paintText
-
paintAccelerator
-
paintArrowIcon
-
paintIcon
-
paintText
-
paintHTMLText
-
isArmedOrSelected
Returnstrue
if either the menu item is armed (mouse over item) or it is aJMenu
and 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
-