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

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1997, 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) 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
*** 106,126 **** super.paintBackground(g, menuItem, bgColor); } static void paintBackground(WindowsMenuItemUIAccessor menuItemUI, Graphics g, JMenuItem menuItem, Color bgColor) { ! assert isVistaPainting(); ! if (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, --- 106,126 ---- super.paintBackground(g, menuItem, bgColor); } static void paintBackground(WindowsMenuItemUIAccessor menuItemUI, Graphics g, JMenuItem menuItem, Color bgColor) { ! XPStyle xp = XPStyle.getXP(); ! assert isVistaPainting(xp); ! if (isVistaPainting(xp)) { 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); } Part part = menuItemUI.getPart(menuItem); Skin skin = xp.getSkin(menuItem, part); skin.paintSkin(g, 0 , 0, menuWidth, menuHeight,
*** 168,177 **** /* * TODO idk can we use XPStyle.isVista? * is it possible that in some theme some Vista parts are not defined while * others are? */ ! static boolean isVistaPainting() { ! XPStyle xp = XPStyle.getXP(); return xp != null && xp.isSkinDefined(null, Part.MP_POPUPITEM); } } --- 168,180 ---- /* * TODO idk can we use XPStyle.isVista? * is it possible that in some theme some Vista parts are not defined while * others are? */ ! static boolean isVistaPainting(final XPStyle xp) { return xp != null && xp.isSkinDefined(null, Part.MP_POPUPITEM); } + + static boolean isVistaPainting() { + return isVistaPainting(XPStyle.getXP()); + } }