src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 611,622 ****
} // End class MenuItemArrowIcon
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;
}
--- 611,622 ----
} // End class MenuItemArrowIcon
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;
}
*** 645,664 ****
}
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;
}
}
--- 645,666 ----
}
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;
}
}
*** 680,690 ****
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;
--- 682,693 ----
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;
*** 743,758 ****
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();
--- 746,766 ----
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();
*** 796,816 ****
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(
--- 804,826 ----
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(