Package com.formdev.flatlaf.ui
Class FlatMenuItemRenderer
- java.lang.Object
-
- com.formdev.flatlaf.ui.FlatMenuItemRenderer
-
- Direct Known Subclasses:
FlatMenuUI.FlatMenuRenderer
public class FlatMenuItemRenderer extends Object
Renderer for menu items.- UiDefault:
- MenuItem.verticallyAlignText boolean, MenuItem.minimumWidth int, MenuItem.minimumIconSize Dimension, MenuItem.textAcceleratorGap int, MenuItem.textNoAcceleratorGap int, MenuItem.acceleratorArrowGap int, MenuItem.checkBackground Color, MenuItem.checkMargins Insets, MenuItem.selectionInsets Insets, MenuItem.selectionArc int, MenuItem.selectionType String null (default) or underline, MenuItem.underlineSelectionBackground Color, MenuItem.underlineSelectionCheckBackground Color, MenuItem.underlineSelectionColor Color, MenuItem.underlineSelectionHeight int
-
-
Field Summary
Fields Modifier and Type Field Description protected intacceleratorArrowGapprotected StringacceleratorDelimiterprotected FontacceleratorFontprotected IconarrowIconprotected ColorcheckBackgroundprotected IconcheckIconprotected InsetscheckMarginsprotected JMenuItemmenuItemprotected DimensionminimumIconSizeprotected intminimumWidthprotected intselectionArcprotected InsetsselectionInsetsprotected inttextAcceleratorGapprotected inttextNoAcceleratorGapprotected ColorunderlineSelectionBackgroundprotected ColorunderlineSelectionCheckBackgroundprotected ColorunderlineSelectionColorprotected intunderlineSelectionHeightprotected booleanverticallyAlignText
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ObjectapplyStyleProperty(String key, Object value)protected ColorderiveBackground(Color background)protected StringgetMacOSModifiersExText(int modifiers, boolean leftToRight)protected DimensiongetPreferredMenuItemSize()Map<String,Class<?>>getStyleableInfos()ObjectgetStyleableValue(String key)protected StringgetTextForAccelerator(KeyStroke accelerator)protected static booleanisArmedOrSelected(JMenuItem menuItem)Returnstrueif either the menu item is armed (mouse over item) or it is aJMenuand selected (shows submenu).protected static booleanisTopLevelMenu(JMenuItem menuItem)protected booleanisUnderlineSelection()protected voidpaintAccelerator(Graphics g, Rectangle accelRect, String accelText, Color foreground, Color selectionForeground, Color disabledForeground)protected voidpaintArrowIcon(Graphics g, Rectangle arrowRect, Icon arrowIcon)protected voidpaintBackground(Graphics g)protected 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 voidpaintIcon(Graphics g, JMenuItem menuItem, Icon icon, Rectangle iconRect)protected 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 Detail
-
menuItem
protected final JMenuItem menuItem
-
checkIcon
protected Icon checkIcon
-
arrowIcon
protected Icon arrowIcon
-
acceleratorFont
protected Font acceleratorFont
-
acceleratorDelimiter
protected final String acceleratorDelimiter
-
verticallyAlignText
protected boolean verticallyAlignText
- Since:
- 2
-
minimumWidth
protected int minimumWidth
-
minimumIconSize
protected Dimension minimumIconSize
-
textAcceleratorGap
protected int textAcceleratorGap
-
textNoAcceleratorGap
protected int textNoAcceleratorGap
-
acceleratorArrowGap
protected int acceleratorArrowGap
-
checkBackground
protected Color checkBackground
-
checkMargins
protected Insets checkMargins
-
selectionInsets
protected Insets selectionInsets
- Since:
- 3
-
selectionArc
protected int selectionArc
- Since:
- 3
-
underlineSelectionBackground
protected Color underlineSelectionBackground
-
underlineSelectionCheckBackground
protected Color underlineSelectionCheckBackground
-
underlineSelectionColor
protected Color underlineSelectionColor
-
underlineSelectionHeight
protected int underlineSelectionHeight
-
-
Method Detail
-
getPreferredMenuItemSize
protected Dimension getPreferredMenuItemSize()
-
paintMenuItem
protected void paintMenuItem(Graphics g, Color selectionBackground, Color selectionForeground, Color disabledForeground, Color acceleratorForeground, Color acceleratorSelectionForeground)
-
paintBackground
protected void paintBackground(Graphics g)
- 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
-
paintIcon
protected void paintIcon(Graphics g, Rectangle iconRect, Icon icon, Color checkBackground, Color selectionBackground)
-
paintText
protected void paintText(Graphics g, Rectangle textRect, String text, Color selectionForeground, Color disabledForeground)
-
paintAccelerator
protected void paintAccelerator(Graphics g, Rectangle accelRect, String accelText, Color foreground, Color selectionForeground, Color disabledForeground)
-
paintIcon
protected static void paintIcon(Graphics g, JMenuItem menuItem, Icon icon, Rectangle iconRect)
-
paintText
protected static void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text, int mnemonicIndex, Font font, Color foreground, Color selectionForeground, Color disabledForeground)
-
paintHTMLText
protected static void paintHTMLText(Graphics g, JMenuItem menuItem, Rectangle textRect, View htmlView, Color selectionForeground)
-
isArmedOrSelected
protected static boolean isArmedOrSelected(JMenuItem menuItem)
Returnstrueif either the menu item is armed (mouse over item) or it is aJMenuand selected (shows submenu).
-
isTopLevelMenu
protected static boolean isTopLevelMenu(JMenuItem menuItem)
-
isUnderlineSelection
protected boolean isUnderlineSelection()
-
getMacOSModifiersExText
protected String getMacOSModifiersExText(int modifiers, boolean leftToRight)
-
-