Java Code Examples for sun.swing.MenuItemLayoutHelper#useCheckAndArrow()
The following examples show how to use
sun.swing.MenuItemLayoutHelper#useCheckAndArrow() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SynthGraphicsUtils.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
static void paint(SynthContext context, SynthContext accContext, Graphics g, Icon checkIcon, Icon arrowIcon, String acceleratorDelimiter, int defaultTextIconGap, String propertyPrefix) { JMenuItem mi = (JMenuItem) context.getComponent(); SynthStyle style = context.getStyle(); g.setFont(style.getFont(context)); Rectangle viewRect = new Rectangle(0, 0, mi.getWidth(), mi.getHeight()); boolean leftToRight = SynthLookAndFeel.isLeftToRight(mi); applyInsets(viewRect, mi.getInsets(), leftToRight); SynthMenuItemLayoutHelper lh = new SynthMenuItemLayoutHelper( context, accContext, mi, checkIcon, arrowIcon, viewRect, defaultTextIconGap, acceleratorDelimiter, leftToRight, MenuItemLayoutHelper.useCheckAndArrow(mi), propertyPrefix); MenuItemLayoutHelper.LayoutResult lr = lh.layoutMenuItem(); paintMenuItem(g, lh, lr); }
Example 2
Source File: SynthGraphicsUtils.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
static void paint(SynthContext context, SynthContext accContext, Graphics g, Icon checkIcon, Icon arrowIcon, String acceleratorDelimiter, int defaultTextIconGap, String propertyPrefix) { JMenuItem mi = (JMenuItem) context.getComponent(); SynthStyle style = context.getStyle(); g.setFont(style.getFont(context)); Rectangle viewRect = new Rectangle(0, 0, mi.getWidth(), mi.getHeight()); boolean leftToRight = SynthLookAndFeel.isLeftToRight(mi); applyInsets(viewRect, mi.getInsets(), leftToRight); SynthMenuItemLayoutHelper lh = new SynthMenuItemLayoutHelper( context, accContext, mi, checkIcon, arrowIcon, viewRect, defaultTextIconGap, acceleratorDelimiter, leftToRight, MenuItemLayoutHelper.useCheckAndArrow(mi), propertyPrefix); MenuItemLayoutHelper.LayoutResult lr = lh.layoutMenuItem(); paintMenuItem(g, lh, lr); }
Example 3
Source File: SeaGlassGraphicsUtils.java From seaglass with Apache License 2.0 | 6 votes |
public static void paint(SynthContext context, SynthContext accContext, Graphics g, Icon checkIcon, Icon arrowIcon, String acceleratorDelimiter, int defaultTextIconGap, String propertyPrefix) { JMenuItem mi = (JMenuItem) context.getComponent(); SynthStyle style = context.getStyle(); g.setFont(style.getFont(context)); Rectangle viewRect = new Rectangle(0, 0, mi.getWidth(), mi.getHeight()); boolean leftToRight = SeaGlassLookAndFeel.isLeftToRight(mi); applyInsets(viewRect, mi.getInsets(), leftToRight); SeaGlassMenuItemLayoutHelper lh = new SeaGlassMenuItemLayoutHelper(context, accContext, mi, checkIcon, arrowIcon, viewRect, defaultTextIconGap, acceleratorDelimiter, leftToRight, MenuItemLayoutHelper.useCheckAndArrow(mi), propertyPrefix); MenuItemLayoutHelper.LayoutResult lr = lh.layoutMenuItem(); paintMenuItem(g, lh, lr); }
Example 4
Source File: SynthGraphicsUtils.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
static void paint(SynthContext context, SynthContext accContext, Graphics g, Icon checkIcon, Icon arrowIcon, String acceleratorDelimiter, int defaultTextIconGap, String propertyPrefix) { JMenuItem mi = (JMenuItem) context.getComponent(); SynthStyle style = context.getStyle(); g.setFont(style.getFont(context)); Rectangle viewRect = new Rectangle(0, 0, mi.getWidth(), mi.getHeight()); boolean leftToRight = SynthLookAndFeel.isLeftToRight(mi); applyInsets(viewRect, mi.getInsets(), leftToRight); SynthMenuItemLayoutHelper lh = new SynthMenuItemLayoutHelper( context, accContext, mi, checkIcon, arrowIcon, viewRect, defaultTextIconGap, acceleratorDelimiter, leftToRight, MenuItemLayoutHelper.useCheckAndArrow(mi), propertyPrefix); MenuItemLayoutHelper.LayoutResult lr = lh.layoutMenuItem(); paintMenuItem(g, lh, lr); }
Example 5
Source File: SynthGraphicsUtils.java From JDKSourceCode1.8 with MIT License | 6 votes |
static void paint(SynthContext context, SynthContext accContext, Graphics g, Icon checkIcon, Icon arrowIcon, String acceleratorDelimiter, int defaultTextIconGap, String propertyPrefix) { JMenuItem mi = (JMenuItem) context.getComponent(); SynthStyle style = context.getStyle(); g.setFont(style.getFont(context)); Rectangle viewRect = new Rectangle(0, 0, mi.getWidth(), mi.getHeight()); boolean leftToRight = SynthLookAndFeel.isLeftToRight(mi); applyInsets(viewRect, mi.getInsets(), leftToRight); SynthMenuItemLayoutHelper lh = new SynthMenuItemLayoutHelper( context, accContext, mi, checkIcon, arrowIcon, viewRect, defaultTextIconGap, acceleratorDelimiter, leftToRight, MenuItemLayoutHelper.useCheckAndArrow(mi), propertyPrefix); MenuItemLayoutHelper.LayoutResult lr = lh.layoutMenuItem(); paintMenuItem(g, lh, lr); }
Example 6
Source File: SynthGraphicsUtils.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
static void paint(SynthContext context, SynthContext accContext, Graphics g, Icon checkIcon, Icon arrowIcon, String acceleratorDelimiter, int defaultTextIconGap, String propertyPrefix) { JMenuItem mi = (JMenuItem) context.getComponent(); SynthStyle style = context.getStyle(); g.setFont(style.getFont(context)); Rectangle viewRect = new Rectangle(0, 0, mi.getWidth(), mi.getHeight()); boolean leftToRight = SynthLookAndFeel.isLeftToRight(mi); applyInsets(viewRect, mi.getInsets(), leftToRight); SynthMenuItemLayoutHelper lh = new SynthMenuItemLayoutHelper( context, accContext, mi, checkIcon, arrowIcon, viewRect, defaultTextIconGap, acceleratorDelimiter, leftToRight, MenuItemLayoutHelper.useCheckAndArrow(mi), propertyPrefix); MenuItemLayoutHelper.LayoutResult lr = lh.layoutMenuItem(); paintMenuItem(g, lh, lr); }
Example 7
Source File: SynthGraphicsUtils.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
static void paint(SynthContext context, SynthContext accContext, Graphics g, Icon checkIcon, Icon arrowIcon, String acceleratorDelimiter, int defaultTextIconGap, String propertyPrefix) { JMenuItem mi = (JMenuItem) context.getComponent(); SynthStyle style = context.getStyle(); g.setFont(style.getFont(context)); Rectangle viewRect = new Rectangle(0, 0, mi.getWidth(), mi.getHeight()); boolean leftToRight = SynthLookAndFeel.isLeftToRight(mi); applyInsets(viewRect, mi.getInsets(), leftToRight); SynthMenuItemLayoutHelper lh = new SynthMenuItemLayoutHelper( context, accContext, mi, checkIcon, arrowIcon, viewRect, defaultTextIconGap, acceleratorDelimiter, leftToRight, MenuItemLayoutHelper.useCheckAndArrow(mi), propertyPrefix); MenuItemLayoutHelper.LayoutResult lr = lh.layoutMenuItem(); paintMenuItem(g, lh, lr); }
Example 8
Source File: SynthGraphicsUtils.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
static void paint(SynthContext context, SynthContext accContext, Graphics g, Icon checkIcon, Icon arrowIcon, String acceleratorDelimiter, int defaultTextIconGap, String propertyPrefix) { JMenuItem mi = (JMenuItem) context.getComponent(); SynthStyle style = context.getStyle(); g.setFont(style.getFont(context)); Rectangle viewRect = new Rectangle(0, 0, mi.getWidth(), mi.getHeight()); boolean leftToRight = SynthLookAndFeel.isLeftToRight(mi); applyInsets(viewRect, mi.getInsets(), leftToRight); SynthMenuItemLayoutHelper lh = new SynthMenuItemLayoutHelper( context, accContext, mi, checkIcon, arrowIcon, viewRect, defaultTextIconGap, acceleratorDelimiter, leftToRight, MenuItemLayoutHelper.useCheckAndArrow(mi), propertyPrefix); MenuItemLayoutHelper.LayoutResult lr = lh.layoutMenuItem(); paintMenuItem(g, lh, lr); }
Example 9
Source File: SynthGraphicsUtils.java From Java8CN with Apache License 2.0 | 6 votes |
static void paint(SynthContext context, SynthContext accContext, Graphics g, Icon checkIcon, Icon arrowIcon, String acceleratorDelimiter, int defaultTextIconGap, String propertyPrefix) { JMenuItem mi = (JMenuItem) context.getComponent(); SynthStyle style = context.getStyle(); g.setFont(style.getFont(context)); Rectangle viewRect = new Rectangle(0, 0, mi.getWidth(), mi.getHeight()); boolean leftToRight = SynthLookAndFeel.isLeftToRight(mi); applyInsets(viewRect, mi.getInsets(), leftToRight); SynthMenuItemLayoutHelper lh = new SynthMenuItemLayoutHelper( context, accContext, mi, checkIcon, arrowIcon, viewRect, defaultTextIconGap, acceleratorDelimiter, leftToRight, MenuItemLayoutHelper.useCheckAndArrow(mi), propertyPrefix); MenuItemLayoutHelper.LayoutResult lr = lh.layoutMenuItem(); paintMenuItem(g, lh, lr); }
Example 10
Source File: DarkMenuItemUIBase.java From darklaf with MIT License | 6 votes |
protected void paintArrowIcon(final Graphics g, final JMenuItem mi, final MenuItemLayoutHelper lh, final MenuItemLayoutHelper.LayoutResult lr, final Color foreground) { if (lh.getArrowIcon() != null) { ButtonModel model = mi.getModel(); if (model.isArmed() || (mi instanceof JMenu && model.isSelected())) { g.setColor(foreground); } if (lh.useCheckAndArrow()) { lh.getArrowIcon().paintIcon(mi, g, lr.getArrowRect().x, lr.getArrowRect().y); } } }
Example 11
Source File: DarkMenuItemUIBase.java From darklaf with MIT License | 6 votes |
protected void paintCheckIcon(final Graphics g, final JMenuItem mi, final MenuItemLayoutHelper lh, final MenuItemLayoutHelper.LayoutResult lr, final Color holdc, final Color foreground) { if (lh.getCheckIcon() != null) { ButtonModel model = mi.getModel(); if (model.isArmed() || (mi instanceof JMenu && model.isSelected())) { g.setColor(foreground); } else { g.setColor(holdc); } if (lh.useCheckAndArrow()) { lh.getCheckIcon().paintIcon(mi, g, lr.getCheckRect().x, lr.getCheckRect().y); } g.setColor(holdc); } }
Example 12
Source File: DarkMenuItemUIBase.java From darklaf with MIT License | 5 votes |
protected MenuItemLayoutHelper getMenuItemLayoutHelper(final Icon checkIcon, final Icon arrowIcon, final int defaultTextIconGap, final JMenuItem mi, final Rectangle viewRect) { return new MenuItemLayoutHelper(mi, checkIcon, arrowIcon, viewRect, defaultTextIconGap, acceleratorDelimiter, mi.getComponentOrientation().isLeftToRight(), mi.getFont(), acceleratorFont, MenuItemLayoutHelper.useCheckAndArrow(menuItem), getPropertyPrefix()); }
Example 13
Source File: SynthMenuUI.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
private void updateStyle(JMenuItem mi) { SynthStyle oldStyle = style; SynthContext context = getContext(mi, ENABLED); style = SynthLookAndFeel.updateStyle(context, this); if (oldStyle != style) { String prefix = getPropertyPrefix(); defaultTextIconGap = style.getInt( context, prefix + ".textIconGap", 4); if (menuItem.getMargin() == null || (menuItem.getMargin() instanceof UIResource)) { Insets insets = (Insets)style.get(context, prefix + ".margin"); if (insets == null) { // Some places assume margins are non-null. insets = SynthLookAndFeel.EMPTY_UIRESOURCE_INSETS; } menuItem.setMargin(insets); } acceleratorDelimiter = style.getString(context, prefix + ".acceleratorDelimiter", "+"); if (MenuItemLayoutHelper.useCheckAndArrow(menuItem)) { checkIcon = style.getIcon(context, prefix + ".checkIcon"); arrowIcon = style.getIcon(context, prefix + ".arrowIcon"); } else { // Not needed in this case checkIcon = null; arrowIcon = null; } ((JMenu)menuItem).setDelay(style.getInt(context, prefix + ".delay", 200)); if (oldStyle != null) { uninstallKeyboardActions(); installKeyboardActions(); } } context.dispose(); SynthContext accContext = getContext(mi, Region.MENU_ITEM_ACCELERATOR, ENABLED); accStyle = SynthLookAndFeel.updateStyle(accContext, this); accContext.dispose(); }
Example 14
Source File: SynthMenuUI.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
private void updateStyle(JMenuItem mi) { SynthStyle oldStyle = style; SynthContext context = getContext(mi, ENABLED); style = SynthLookAndFeel.updateStyle(context, this); if (oldStyle != style) { String prefix = getPropertyPrefix(); defaultTextIconGap = style.getInt( context, prefix + ".textIconGap", 4); if (menuItem.getMargin() == null || (menuItem.getMargin() instanceof UIResource)) { Insets insets = (Insets)style.get(context, prefix + ".margin"); if (insets == null) { // Some places assume margins are non-null. insets = SynthLookAndFeel.EMPTY_UIRESOURCE_INSETS; } menuItem.setMargin(insets); } acceleratorDelimiter = style.getString(context, prefix + ".acceleratorDelimiter", "+"); if (MenuItemLayoutHelper.useCheckAndArrow(menuItem)) { checkIcon = style.getIcon(context, prefix + ".checkIcon"); arrowIcon = style.getIcon(context, prefix + ".arrowIcon"); } else { // Not needed in this case checkIcon = null; arrowIcon = null; } ((JMenu)menuItem).setDelay(style.getInt(context, prefix + ".delay", 200)); if (oldStyle != null) { uninstallKeyboardActions(); installKeyboardActions(); } } context.dispose(); SynthContext accContext = getContext(mi, Region.MENU_ITEM_ACCELERATOR, ENABLED); accStyle = SynthLookAndFeel.updateStyle(accContext, this); accContext.dispose(); }
Example 15
Source File: SynthMenuUI.java From JDKSourceCode1.8 with MIT License | 4 votes |
private void updateStyle(JMenuItem mi) { SynthStyle oldStyle = style; SynthContext context = getContext(mi, ENABLED); style = SynthLookAndFeel.updateStyle(context, this); if (oldStyle != style) { String prefix = getPropertyPrefix(); defaultTextIconGap = style.getInt( context, prefix + ".textIconGap", 4); if (menuItem.getMargin() == null || (menuItem.getMargin() instanceof UIResource)) { Insets insets = (Insets)style.get(context, prefix + ".margin"); if (insets == null) { // Some places assume margins are non-null. insets = SynthLookAndFeel.EMPTY_UIRESOURCE_INSETS; } menuItem.setMargin(insets); } acceleratorDelimiter = style.getString(context, prefix + ".acceleratorDelimiter", "+"); if (MenuItemLayoutHelper.useCheckAndArrow(menuItem)) { checkIcon = style.getIcon(context, prefix + ".checkIcon"); arrowIcon = style.getIcon(context, prefix + ".arrowIcon"); } else { // Not needed in this case checkIcon = null; arrowIcon = null; } ((JMenu)menuItem).setDelay(style.getInt(context, prefix + ".delay", 200)); if (oldStyle != null) { uninstallKeyboardActions(); installKeyboardActions(); } } context.dispose(); SynthContext accContext = getContext(mi, Region.MENU_ITEM_ACCELERATOR, ENABLED); accStyle = SynthLookAndFeel.updateStyle(accContext, this); accContext.dispose(); }
Example 16
Source File: SynthMenuUI.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
private void updateStyle(JMenuItem mi) { SynthStyle oldStyle = style; SynthContext context = getContext(mi, ENABLED); style = SynthLookAndFeel.updateStyle(context, this); if (oldStyle != style) { String prefix = getPropertyPrefix(); defaultTextIconGap = style.getInt( context, prefix + ".textIconGap", 4); if (menuItem.getMargin() == null || (menuItem.getMargin() instanceof UIResource)) { Insets insets = (Insets)style.get(context, prefix + ".margin"); if (insets == null) { // Some places assume margins are non-null. insets = SynthLookAndFeel.EMPTY_UIRESOURCE_INSETS; } menuItem.setMargin(insets); } acceleratorDelimiter = style.getString(context, prefix + ".acceleratorDelimiter", "+"); if (MenuItemLayoutHelper.useCheckAndArrow(menuItem)) { checkIcon = style.getIcon(context, prefix + ".checkIcon"); arrowIcon = style.getIcon(context, prefix + ".arrowIcon"); } else { // Not needed in this case checkIcon = null; arrowIcon = null; } ((JMenu)menuItem).setDelay(style.getInt(context, prefix + ".delay", 200)); if (oldStyle != null) { uninstallKeyboardActions(); installKeyboardActions(); } } context.dispose(); SynthContext accContext = getContext(mi, Region.MENU_ITEM_ACCELERATOR, ENABLED); accStyle = SynthLookAndFeel.updateStyle(accContext, this); accContext.dispose(); }
Example 17
Source File: SynthMenuUI.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
private void updateStyle(JMenuItem mi) { SynthStyle oldStyle = style; SynthContext context = getContext(mi, ENABLED); style = SynthLookAndFeel.updateStyle(context, this); if (oldStyle != style) { String prefix = getPropertyPrefix(); defaultTextIconGap = style.getInt( context, prefix + ".textIconGap", 4); if (menuItem.getMargin() == null || (menuItem.getMargin() instanceof UIResource)) { Insets insets = (Insets)style.get(context, prefix + ".margin"); if (insets == null) { // Some places assume margins are non-null. insets = SynthLookAndFeel.EMPTY_UIRESOURCE_INSETS; } menuItem.setMargin(insets); } acceleratorDelimiter = style.getString(context, prefix + ".acceleratorDelimiter", "+"); if (MenuItemLayoutHelper.useCheckAndArrow(menuItem)) { checkIcon = style.getIcon(context, prefix + ".checkIcon"); arrowIcon = style.getIcon(context, prefix + ".arrowIcon"); } else { // Not needed in this case checkIcon = null; arrowIcon = null; } ((JMenu)menuItem).setDelay(style.getInt(context, prefix + ".delay", 200)); if (oldStyle != null) { uninstallKeyboardActions(); installKeyboardActions(); } } context.dispose(); SynthContext accContext = getContext(mi, Region.MENU_ITEM_ACCELERATOR, ENABLED); accStyle = SynthLookAndFeel.updateStyle(accContext, this); accContext.dispose(); }
Example 18
Source File: SeaGlassMenuUI.java From seaglass with Apache License 2.0 | 4 votes |
private void updateStyle(JMenuItem mi) { SynthStyle oldStyle = style; SeaGlassContext context = getContext(mi, ENABLED); style = SeaGlassLookAndFeel.updateStyle(context, this); if (oldStyle != style) { String prefix = getPropertyPrefix(); defaultTextIconGap = style.getInt(context, prefix + ".textIconGap", 4); if (menuItem.getMargin() == null || (menuItem.getMargin() instanceof UIResource)) { Insets insets = (Insets) style.get(context, prefix + ".margin"); if (insets == null) { // Some places assume margins are non-null. insets = SeaGlassLookAndFeel.EMPTY_UIRESOURCE_INSETS; } menuItem.setMargin(insets); } acceleratorDelimiter = style.getString(context, prefix + ".acceleratorDelimiter", "+"); if (MenuItemLayoutHelper.useCheckAndArrow(menuItem)) { checkIcon = style.getIcon(context, prefix + ".checkIcon"); arrowIcon = style.getIcon(context, prefix + ".arrowIcon"); } else { // Not needed in this case checkIcon = null; arrowIcon = null; } ((JMenu) menuItem).setDelay(style.getInt(context, prefix + ".delay", 200)); if (oldStyle != null) { uninstallKeyboardActions(); installKeyboardActions(); } } context.dispose(); SeaGlassContext accContext = getContext(mi, Region.MENU_ITEM_ACCELERATOR, ENABLED); accStyle = SeaGlassLookAndFeel.updateStyle(accContext, this); accContext.dispose(); }
Example 19
Source File: SynthMenuUI.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
private void updateStyle(JMenuItem mi) { SynthStyle oldStyle = style; SynthContext context = getContext(mi, ENABLED); style = SynthLookAndFeel.updateStyle(context, this); if (oldStyle != style) { String prefix = getPropertyPrefix(); defaultTextIconGap = style.getInt( context, prefix + ".textIconGap", 4); if (menuItem.getMargin() == null || (menuItem.getMargin() instanceof UIResource)) { Insets insets = (Insets)style.get(context, prefix + ".margin"); if (insets == null) { // Some places assume margins are non-null. insets = SynthLookAndFeel.EMPTY_UIRESOURCE_INSETS; } menuItem.setMargin(insets); } acceleratorDelimiter = style.getString(context, prefix + ".acceleratorDelimiter", "+"); if (MenuItemLayoutHelper.useCheckAndArrow(menuItem)) { checkIcon = style.getIcon(context, prefix + ".checkIcon"); arrowIcon = style.getIcon(context, prefix + ".arrowIcon"); } else { // Not needed in this case checkIcon = null; arrowIcon = null; } ((JMenu)menuItem).setDelay(style.getInt(context, prefix + ".delay", 200)); if (oldStyle != null) { uninstallKeyboardActions(); installKeyboardActions(); } } context.dispose(); SynthContext accContext = getContext(mi, Region.MENU_ITEM_ACCELERATOR, ENABLED); accStyle = SynthLookAndFeel.updateStyle(accContext, this); accContext.dispose(); }
Example 20
Source File: SynthMenuUI.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
private void updateStyle(JMenuItem mi) { SynthStyle oldStyle = style; SynthContext context = getContext(mi, ENABLED); style = SynthLookAndFeel.updateStyle(context, this); if (oldStyle != style) { String prefix = getPropertyPrefix(); defaultTextIconGap = style.getInt( context, prefix + ".textIconGap", 4); if (menuItem.getMargin() == null || (menuItem.getMargin() instanceof UIResource)) { Insets insets = (Insets)style.get(context, prefix + ".margin"); if (insets == null) { // Some places assume margins are non-null. insets = SynthLookAndFeel.EMPTY_UIRESOURCE_INSETS; } menuItem.setMargin(insets); } acceleratorDelimiter = style.getString(context, prefix + ".acceleratorDelimiter", "+"); if (MenuItemLayoutHelper.useCheckAndArrow(menuItem)) { checkIcon = style.getIcon(context, prefix + ".checkIcon"); arrowIcon = style.getIcon(context, prefix + ".arrowIcon"); } else { // Not needed in this case checkIcon = null; arrowIcon = null; } ((JMenu)menuItem).setDelay(style.getInt(context, prefix + ".delay", 200)); if (oldStyle != null) { uninstallKeyboardActions(); installKeyboardActions(); } } SynthContext accContext = getContext(mi, Region.MENU_ITEM_ACCELERATOR, ENABLED); accStyle = SynthLookAndFeel.updateStyle(accContext, this); }