Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4842445
Votes 0
Synopsis ClassCastException in BasicComboboxUI using Multi-UI
Category java:classes_swing
Reported Against 1.4
Release Fixed
State 11-Closed, duplicate of 4632193, bug
Priority: 4-Low
Related Bugs 4632193
Submit Date 03-APR-2003
Description




FULL PRODUCT VERSION :
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)

FULL OPERATING SYSTEM VERSION :
 customer  Windows 2000 [Version 5.00.2195]

ADDITIONAL OPERATING SYSTEMS :
not tested


A DESCRIPTION OF THE PROBLEM :
When using an auxiliary Look and Feel, java uses
automatically the Multi LAF as UI delegate. However the
BasicComboBoxUI expects to have a BasicComboboxUI installed
on a JCombobox when performing the UpAction.
The following code snippet comes from BasicComboBoxUI.java in
the src.zip from the SDK:

static class UpAction extends AbstractAction {
	public void actionPerformed(ActionEvent e) {
	    JComboBox comboBox = (JComboBox)e.getSource();
	    if ( comboBox.isEnabled() ) {
		BasicComboBoxUI ui = (BasicComboBoxUI)comboBox.getUI();
		if (ui.isPopupVisible(comboBox)) {
                    ui.selectPreviousPossibleValue();
                }
            }
        }
    }

When using a Multi-LAF the cast to a BasicComboBoxUI is not
legal an causes an exception:

java.lang.ClassCastException:
javax.swing.plaf.multi.MultiComboBoxUI
	at
javax.swing.plaf.basic.BasicComboBoxUI$UpAction.actionPerfor
med(BasicComboBoxUI.java:1530)
	at javax.swing.SwingUtilities.notifyAction
(SwingUtilities.java:1502)
	at javax.swing.JComponent.processKeyBinding
(JComponent.java:2422)
	at javax.swing.JComponent.processKeyBindings
(JComponent.java:2468)
	at javax.swing.JComponent.processKeyEvent
(JComponent.java:2385)
	at java.awt.Component.processEvent
(Component.java:4830)
	at java.awt.Container.processEvent
(Container.java:1380)

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. install an auxiliary Look and Feel (either by setting
the property or by doing it by run time)
2. use a combobox
3. pop it up and press the UP-Key

EXPECTED VERSUS ACTUAL BEHAVIOR :
normally the selected entry in the popup window of the
combobox moves up one entry.

When using a Multi-LAF an exception occurs

ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.ClassCastException: javax.swing.plaf.multi.MultiComboBoxUI
	at javax.swing.plaf.basic.BasicComboBoxUI$UpAction.actionPerformed
(BasicComboBoxUI.java:1530)
	at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1502)
	at javax.swing.JComponent.processKeyBinding(JComponent.java:2422)
	at javax.swing.JComponent.processKeyBindings(JComponent.java:2468)
	at javax.swing.JComponent.processKeyEvent(JComponent.java:2385)
	at java.awt.Component.processEvent(Component.java:4830)
	at java.awt.Container.processEvent(Container.java:1380)

REPRODUCIBILITY :
This bug can be reproduced always.
(Review ID: 179623) 
======================================================================
Work Around
N/A
Evaluation
This was fixed as part of the actions reworking that was done for synth:
4632193.
  xxxxx@xxxxx   2003-08-12
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang