src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java

Print this page

        

*** 621,632 **** } // End class MenuItemArrowIcon @SuppressWarnings("serial") // Same-version serialization only private static class MenuArrowIcon implements Icon, UIResource, Serializable { public void paintIcon(Component c, Graphics g, int x, int y) { - if (WindowsMenuItemUI.isVistaPainting()) { XPStyle xp = XPStyle.getXP(); State state = State.NORMAL; if (c instanceof JMenuItem) { state = ((JMenuItem) c).getModel().isEnabled() ? State.NORMAL : State.DISABLED; } --- 621,632 ---- } // End class MenuItemArrowIcon @SuppressWarnings("serial") // Same-version serialization only private static class MenuArrowIcon implements Icon, UIResource, Serializable { public void paintIcon(Component c, Graphics g, int x, int y) { XPStyle xp = XPStyle.getXP(); + if (WindowsMenuItemUI.isVistaPainting(xp)) { State state = State.NORMAL; if (c instanceof JMenuItem) { state = ((JMenuItem) c).getModel().isEnabled() ? State.NORMAL : State.DISABLED; }
*** 655,674 **** } g.translate(-x,-y); } } public int getIconWidth() { ! if (WindowsMenuItemUI.isVistaPainting()) { ! Skin skin = XPStyle.getXP().getSkin(null, Part.MP_POPUPSUBMENU); return skin.getWidth(); } else { return 4; } } public int getIconHeight() { ! if (WindowsMenuItemUI.isVistaPainting()) { ! Skin skin = XPStyle.getXP().getSkin(null, Part.MP_POPUPSUBMENU); return skin.getHeight(); } else { return 8; } } --- 655,676 ---- } g.translate(-x,-y); } } public int getIconWidth() { ! XPStyle xp = XPStyle.getXP(); ! if (WindowsMenuItemUI.isVistaPainting(xp)) { ! Skin skin = xp.getSkin(null, Part.MP_POPUPSUBMENU); return skin.getWidth(); } else { return 4; } } public int getIconHeight() { ! XPStyle xp = XPStyle.getXP(); ! if (WindowsMenuItemUI.isVistaPainting(xp)) { ! Skin skin = xp.getSkin(null, Part.MP_POPUPSUBMENU); return skin.getHeight(); } else { return 8; } }
*** 690,700 **** public Icon getIcon(String type) { return new VistaMenuItemCheckIcon(type); } static int getIconWidth() { ! return XPStyle.getXP().getSkin(null, Part.MP_POPUPCHECK).getWidth() + 2 * OFFSET; } private static Class<? extends JMenuItem> getType(Component c) { Class<? extends JMenuItem> rv = null; --- 692,703 ---- public Icon getIcon(String type) { return new VistaMenuItemCheckIcon(type); } static int getIconWidth() { ! XPStyle xp = XPStyle.getXP(); ! return ((xp != null) ? xp.getSkin(null, Part.MP_POPUPCHECK).getWidth() : 16) + 2 * OFFSET; } private static Class<? extends JMenuItem> getType(Component c) { Class<? extends JMenuItem> rv = null;
*** 754,769 **** return lafIcon.getIconHeight(); } Icon icon = getIcon(); int height = 0; if (icon != null) { ! height = icon.getIconHeight() + 2 * OFFSET; } else { ! Skin skin = ! XPStyle.getXP().getSkin(null, Part.MP_POPUPCHECK); ! height = skin.getHeight() + 2 * OFFSET; } return height; } public int getIconWidth() { Icon lafIcon = getLaFIcon(); --- 757,777 ---- return lafIcon.getIconHeight(); } Icon icon = getIcon(); int height = 0; if (icon != null) { ! height = icon.getIconHeight(); ! } else { ! XPStyle xp = XPStyle.getXP(); ! if (xp != null) { ! Skin skin = xp.getSkin(null, Part.MP_POPUPCHECK); ! height = skin.getHeight(); } else { ! height = 16; } + } + height += 2 * OFFSET; return height; } public int getIconWidth() { Icon lafIcon = getLaFIcon();
*** 807,827 **** state = (type == JRadioButtonMenuItem.class) ? State.BULLETDISABLED : State.CHECKMARKDISABLED; } - Skin skin; XPStyle xp = XPStyle.getXP(); skin = xp.getSkin(c, backgroundPart); skin.paintSkin(g, x, y, getIconWidth(), getIconHeight(), backgroundState); if (icon == null) { skin = xp.getSkin(c, part); skin.paintSkin(g, x + OFFSET, y + OFFSET, state); } } } if (icon != null) { icon.paintIcon(c, g, x + OFFSET, y + OFFSET); } } private static WindowsMenuItemUIAccessor getAccessor( --- 815,837 ---- state = (type == JRadioButtonMenuItem.class) ? State.BULLETDISABLED : State.CHECKMARKDISABLED; } XPStyle xp = XPStyle.getXP(); + if (xp != null) { + Skin skin; skin = xp.getSkin(c, backgroundPart); skin.paintSkin(g, x, y, getIconWidth(), getIconHeight(), backgroundState); if (icon == null) { skin = xp.getSkin(c, part); skin.paintSkin(g, x + OFFSET, y + OFFSET, state); } } } + } if (icon != null) { icon.paintIcon(c, g, x + OFFSET, y + OFFSET); } } private static WindowsMenuItemUIAccessor getAccessor(