src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -107,20 +107,20 @@
}
static void paintBackground(WindowsMenuItemUIAccessor menuItemUI,
Graphics g, JMenuItem menuItem, Color bgColor) {
assert isVistaPainting();
- if (isVistaPainting()) {
+ XPStyle xp = XPStyle.getXP();
+ if (xp != null && isVistaPainting()) {
int menuWidth = menuItem.getWidth();
int menuHeight = menuItem.getHeight();
if (menuItem.isOpaque()) {
Color oldColor = g.getColor();
g.setColor(menuItem.getBackground());
g.fillRect(0,0, menuWidth, menuHeight);
g.setColor(oldColor);
}
- XPStyle xp = XPStyle.getXP();
Part part = menuItemUI.getPart(menuItem);
Skin skin = xp.getSkin(menuItem, part);
skin.paintSkin(g, 0 , 0,
menuWidth,
menuHeight,