United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 6550847 Action events not firing in JCombox's selected item
6550847 : Action events not firing in JCombox's selected item

Details
Type:
Bug
Submit Date:
2007-04-26
Status:
Closed
Updated Date:
2011-01-19
Project Name:
JDK
Resolved Date:
2009-05-18
Component:
client-libs
OS:
windows_xp
Sub-Component:
javax.swing
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:
6u14

Related Reports
Backport:
Relates:
Relates:
Relates:

Sub Tasks

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

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
I recently updated to version 1.6 of the JRE.  I have several applications build using Netbeans 5.5 and compiled using java version 1.5.0.   After upgrading to version 1.6 The action events for JComboBox, JTextField and JButton do not fire.  These are the only action events I tested so there may be others as well that do not respond to a mouse click or pressing the "Enter" Key.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Install java jre version 1.6 then execute an application build using Swing components that have action events associated with them and compiled using java jdk 1.5.  Select an item from a JComboBox, click on a JButton or press the enter key when the cursor is in a JTextField.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I expected the application to work just like it did using jre version 1.5.  All events should have fired and executed the event handlers attached to the above described objects.
ACTUAL -
None of the action events fired or executed the event handler code assigned to the objects in question.

REPRODUCIBILITY :
This bug can be reproduced always.

Release Regression From : 5.0u11
The above release value was the last known release where this 
bug was not reproducible. Since then there has been a regression.

                                    

Comments
EVALUATION

Here is the complete discussion about this bug:

http://forums.java.net/jive/thread.jspa?messageID=336723
                                     
2009-03-13
EVALUATION

I forgot to mention that this is a regression for the CR 4765319
                                     
2009-03-13
EVALUATION

Here is the test case, tab the first cell, 
press F2 followed by Enter and see the editor is still there
when is should be hidden

import javax.swing.Box;
import javax.swing.DefaultCellEditor;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.SwingUtilities;
import javax.swing.table.DefaultTableModel;
 
public class TableComboEditor {
 
    private JComponent createContent() {
        Object[] data = new Object[] { "somestuff" , "otherstuff", "haha... "};
        DefaultTableModel model = new DefaultTableModel(10, data.length);
        model.insertRow(0, data);
        JTable table = new JTable(model);
        JComboBox box = new JComboBox(new Object[] {"one", "two", "three"});
        table.setDefaultEditor(Object.class, new DefaultCellEditor(box));
        JComponent content = Box.createHorizontalBox();
        content.add(new JScrollPane(table));
        return content;
    }
    
    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                JFrame frame = new JFrame("TableComboEditor");
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.add(new TableComboEditor().createContent());
                frame.pack();
                frame.setVisible(true);
            }
        });
    }
    
}
                                     
2009-03-11
EVALUATION

The only difference between JDK 1.5 and JDK 1.6
is that JDK 1.6 doesn't generate actionEvent 
if a user selects the value in combobox's popup 
which was already selected

Run the provided example with JDK 1.5

Have a look to the  "Select Leader Material" combobox,
Note the "Fluorocarbon" value is selected;
Open this combobox with the mouse and select the same "Fluorocarbon" value;
Notice that the "Calculate" button becomes enabled

Run the provided example with JDK 1.6

Follow the same instructions and
Notice that the "Calculate" button doesn't become enabled
But any new value in the combobox will enable it

No any other differnces were found

Decision:
JDK 1.5 erroneously fires an action if you select the same value in combobox
in JDK 1.6 this bug was fixed, action fires only if you select a *new* value

This CR is not a bug and will be closed

It may be reopened if any new comments/test cases are provided
                                     
2007-07-02
EVALUATION

Hmmm...broken ActionEvents in 6.0 would be a serious issue indeed. But I would expect most Swing applications to be broken and this is the first I've heard. Would be good to get a test case from the submitter.
                                     
2007-06-29



Hardware and Software, Engineered to Work Together