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);
}
});
}
}
|
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
|