Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4890345

1.4.2 REGRESSION: JComboBox has problem in JTable in Windows L&F

    Details

    • Subcomponent:
    • Resolved In Build:
      b01
    • CPU:
      x86
    • OS:
      windows_2000

      Backports

        Description

        Name: jk109818 Date: 07/14/2003


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

        FULL OS VERSION :
        Windows 2000 5.00.2195 Svc Pack 3

        A DESCRIPTION OF THE PROBLEM :
        Using the System LnF for Win 2000, and
        using Keyboard Navigation only tab to a JTable column that has a DefaultCellEditor using a JComboBox. Press F2 to activate the editing feature.

        There is no way to cause the drop down to appear. Using the up and down arrow keys we see no movement of the selected item, but when pressing Enter after an arrow key the value has in fact changed.

        With the Java LnF pressing the down arrow key after F2 causes the dropdown to appear. This is the behavior experienced for the Win LnF in sdk 1.4.1.03 and prior.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Run the example code on a Windows OS.
        Using keyboard navigation tab to a cell in the first column. Press F2.
        Now press the down arrow key twice; then press enter.




        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Pressing the down arrow key I expect to have the drop down of the JComboBox appear.
        ACTUAL -
        No visual indication that the selected item is being changed.

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        import java.awt.BorderLayout;
        import java.util.Vector;

        import javax.swing.*;
        import javax.swing.table.DefaultTableModel;
        import javax.swing.table.TableModel;

        public class TestBug6 extends JFrame {

            public TestBug6(String name) {
                super(name);

                JTable tbl = new JTable();
                JScrollPane panel = new JScrollPane(tbl);
                TableModel tm = createTableModel();
                tbl.setModel(tm);
                tbl.setRowHeight(20);
                
                JComboBox box = new JComboBox();
                box.addItem("tt");
                box.addItem("ll");
                box.addItem("aa");
                box.addItem("gg");
                box.addItem("zz");
                tbl.getColumnModel().getColumn(0).setCellEditor(
                    new DefaultCellEditor(box));

                tbl.setEnabled(true);
                tbl.setCellSelectionEnabled(true);
                getContentPane().add(panel, BorderLayout.CENTER);
                setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            }

            public static void main(String[] args) {
                TestBug6 test = new TestBug6("Java LnF TestBug");
                try {
                    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
                    test = new TestBug6("Native LnF TestBug");
                } catch (Exception e) {
                    e.printStackTrace();
                }
                
                test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                test.pack();
                test.setLocation(100, 70);
                test.setVisible(true);
            }
            
            private TableModel createTableModel(){
                Vector hdr = new Vector();
                hdr.add("One");
                hdr.add("Two");
                Vector data = new Vector();
                Vector row = new Vector();
                row.add("tt");
                row.add("dd");
                data.add(row);
                row = new Vector();
                row.add("ll");
                row.add("jj");
                data.add(row);
                
                return new DefaultTableModel(data, hdr);
            }
        }

        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        Don't use Windows LnF or revert back to 1.4.1

        Release Regression From : 1.4.1_03
        The above release value was the last known release where this
        bug was known to work. Since then there has been a regression.

        (Incident Review ID: 190879)
        ======================================================================

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  kizune Alexander Zuev
                  Reporter:
                  jkimsunw Jeffrey Kim (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: