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

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1997, 2013, 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
*** 35,44 **** --- 35,45 ---- import java.awt.*; import static com.sun.java.swing.plaf.windows.TMSchema.Part; import static com.sun.java.swing.plaf.windows.TMSchema.State; import static com.sun.java.swing.plaf.windows.XPStyle.Skin; + import sun.swing.DefaultLookup; import sun.swing.StringUIClientPropertyKey; /**
*** 229,238 **** --- 230,242 ---- return state; } private void paintXPComboBoxBackground(Graphics g, JComponent c) { XPStyle xp = XPStyle.getXP(); + if (xp == null) { + return; + } State state = getXPComboBoxState(c); Skin skin = null; if (! comboBox.isEditable() && xp.isSkinDefined(c, Part.CP_READONLY)) { skin = xp.getSkin(c, Part.CP_READONLY);
*** 398,419 **** * the popup portion of the combo box. * * @return a button which represents the popup control */ protected JButton createArrowButton() { ! if (XPStyle.getXP() != null) { ! return new XPComboBoxButton(); } else { return super.createArrowButton(); } } @SuppressWarnings("serial") // Superclass is not serializable across versions private class XPComboBoxButton extends XPStyle.GlyphButton { ! public XPComboBoxButton() { super(null, ! (! XPStyle.getXP().isSkinDefined(comboBox, Part.CP_DROPDOWNBUTTONRIGHT)) ? Part.CP_DROPDOWNBUTTON : (comboBox.getComponentOrientation() == ComponentOrientation.RIGHT_TO_LEFT) ? Part.CP_DROPDOWNBUTTONLEFT : Part.CP_DROPDOWNBUTTONRIGHT ); --- 402,424 ---- * the popup portion of the combo box. * * @return a button which represents the popup control */ protected JButton createArrowButton() { ! XPStyle xp = XPStyle.getXP(); ! if (xp != null) { ! return new XPComboBoxButton(xp); } else { return super.createArrowButton(); } } @SuppressWarnings("serial") // Superclass is not serializable across versions private class XPComboBoxButton extends XPStyle.GlyphButton { ! public XPComboBoxButton(XPStyle xp) { super(null, ! (! xp.isSkinDefined(comboBox, Part.CP_DROPDOWNBUTTONRIGHT)) ? Part.CP_DROPDOWNBUTTON : (comboBox.getComponentOrientation() == ComponentOrientation.RIGHT_TO_LEFT) ? Part.CP_DROPDOWNBUTTONLEFT : Part.CP_DROPDOWNBUTTONRIGHT );
*** 422,434 **** @Override protected State getState() { State rv; rv = super.getState(); if (rv != State.DISABLED && comboBox != null && ! comboBox.isEditable() ! && XPStyle.getXP().isSkinDefined(comboBox, Part.CP_DROPDOWNBUTTONRIGHT)) { /* * for non editable ComboBoxes Vista seems to have the * same glyph for all non DISABLED states */ --- 427,440 ---- @Override protected State getState() { State rv; rv = super.getState(); + XPStyle xp = XPStyle.getXP(); if (rv != State.DISABLED && comboBox != null && ! comboBox.isEditable() ! && xp != null && xp.isSkinDefined(comboBox, Part.CP_DROPDOWNBUTTONRIGHT)) { /* * for non editable ComboBoxes Vista seems to have the * same glyph for all non DISABLED states */