/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Windows combo box.
* <p>
* <strong>Warning:</strong>
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is appropriate
* for short term storage or RMI between applications running the same
* version of Swing. A future release of Swing will provide support for
* long term persistence.
*
* @author Tom Santos
* @author Igor Kushnirskiy
*/
new MouseAdapter() {
return;
}
if (! comboBox.isEditable()) {
//mouse over editable ComboBox does not switch rollover
//for the arrow button
ButtonModel m = null;
}
if (m != null ) {
}
}
}
public void mouseEntered(MouseEvent e) {
handleRollover(e, true);
}
public void mouseExited(MouseEvent e) {
handleRollover(e, false);
}
} else if (source instanceof XPComboBoxButton) {
}
return rv;
}
}
return rv;
}
};
private boolean isRollover = false;
new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent e) {
if ("componentOrientation" == propertyName
}
}
}
};
return new WindowsComboBoxUI();
}
super.installUI( c );
isRollover = false;
comboBox.setRequestFocusEnabled( true );
//we can not do it in installListeners because arrowButton
//is initialized after installListeners is invoked
}
}
if(arrowButton != null) {
}
super.uninstallUI( c );
}
/**
* {@inheritDoc}
* @since 1.6
*/
protected void installListeners() {
super.installListeners();
//button glyph for LTR and RTL combobox might differ
}
}
/**
* {@inheritDoc}
* @since 1.6
*/
protected void uninstallListeners() {
super.uninstallListeners();
}
/**
* {@inheritDoc}
* @since 1.6
*/
protected void configureEditor() {
super.configureEditor();
}
}
/**
* {@inheritDoc}
* @since 1.6
*/
protected void unconfigureEditor() {
super.unconfigureEditor();
}
/**
* {@inheritDoc}
* @since 1.6
*/
paintXPComboBoxBackground(g, c);
}
super.paint(g, c);
}
if (!c.isEnabled()) {
} else if (isPopupVisible(comboBox)) {
} else if (isRollover) {
}
return state;
}
if (! comboBox.isEditable()
}
}
}
/**
* If necessary paints the currently selected item.
*
* @param g Graphics to paint to
* @param bounds Region to paint current value to
* @param hasFocus whether or not the JComboBox has focus
* @throws NullPointerException if any of the arguments are null.
* @since 1.5
*/
boolean hasFocus) {
bounds.x += 2;
bounds.y += 2;
} else {
bounds.x += 1;
bounds.y += 1;
}
if (! comboBox.isEditable()
// On vista for READNLY ComboBox
// color for currentValue is the same as for any other item
// mostly copied from javax.swing.plaf.basic.BasicComboBoxUI.paintCurrentValue
Component c;
-1,
true,
false );
} else {
-1,
false,
false );
}
} else {
}
boolean shouldValidate = false;
if (c instanceof JPanel) {
shouldValidate = true;
}
} else {
}
}
/**
* {@inheritDoc}
* @since 1.6
*/
boolean hasFocus) {
}
}
Dimension d = super.getMinimumSize(c);
d.width += 5;
} else {
d.width += 4;
}
d.height += 2;
return d;
}
/**
* Creates a layout manager for managing the components which make up the
* combo box.
*
* @return an instance of a layout manager
*/
return new BasicComboBoxUI.ComboBoxLayoutManager() {
super.layoutContainer(parent);
}
}
};
}
protected void installKeyboardActions() {
super.installKeyboardActions();
}
return super.createPopup();
}
/**
* Creates the default editor that will be used in editable combo boxes.
* A default editor will be used only if an editor has not been
* explicitly set with <code>setEditor</code>.
*
* @return a <code>ComboBoxEditor</code> used for the combo box
* @see javax.swing.JComboBox#setEditor
*/
return new WindowsComboBoxEditor();
}
/**
* {@inheritDoc}
* @since 1.6
*/
return new WindowsComboBoxRenderer();
} else {
return super.createRenderer();
}
}
/**
* Creates an button which will be used as the control to show or hide
* the popup portion of the combo box.
*
* @return a button which represents the popup control
*/
return new XPComboBoxButton();
} else {
return super.createArrowButton();
}
}
public XPComboBoxButton() {
super(null,
);
setRequestFocusEnabled(false);
}
/*
* for non editable ComboBoxes Vista seems to have the
* same glyph for all non DISABLED states
*/
}
return rv;
}
}
}
return WindowsComboBoxUI.this;
}
}
/**
* Subclassed to add Windows specific Key Bindings.
* This class is now obsolete and doesn't do anything.
* Only included for backwards API compatibility.
* Do not call or override.
*
* @deprecated As of Java 2 platform v1.4.
*/
super( cBox );
}
return new InvocationKeyHandler();
}
protected InvocationKeyHandler() {
WindowsComboPopup.this.super();
}
}
}
/**
* Subclassed to highlight selected item in an editable combo box.
*/
public static class WindowsComboBoxEditor
extends BasicComboBoxEditor.UIResource {
/**
* {@inheritDoc}
* @since 1.6
*/
}
return editor;
}
}
}
}
/**
* Subclassed to set opacity {@code false} on the renderer
* and to show border for focused cells.
*/
private static class WindowsComboBoxRenderer
extends BasicComboBoxRenderer.UIResource {
= new StringUIClientPropertyKey("BORDER_KEY");
/**
* {@inheritDoc}
*/
int index,
boolean isSelected,
boolean cellHasFocus) {
if (rv instanceof JComponent) {
//store current border in client property if needed
}
} else {
if (storedBorder instanceof Border) {
: (Border) storedBorder);
}
}
}
if (index == -1) {
} else {
}
}
return rv;
}
}
}