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

Selection in a JList with both scrollbars visible jumps on arrowkey-down

XMLWordPrintable

    • b22
    • x86
    • windows_xp
    • Not verified

        FULL PRODUCT VERSION :
        java version "1.6.0-rc"
        Java(TM) SE Runtime Environment (build 1.6.0-rc-b104)
        Java HotSpot(TM) Client VM (build 1.6.0-rc-b104, mixed mode, sharing)

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

        A DESCRIPTION OF THE PROBLEM :
        pressing arrow-key-down in a jlist with both scrollbars visible,
        first visible index > 0 and select index > visible index makes the list
        jumping down


        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        you can test this with the attached small program.
        just be sure to adjust the window to have both scrollbars visible,
        scroll down to have the visible index > 0 then scroll up some items
        and down again


        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        no jumping list
        ACTUAL -
        jumping list

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        import java.awt.BorderLayout;
        import java.awt.Dimension;

        import javax.swing.DefaultListModel;
        import javax.swing.JFrame;
        import javax.swing.JList;
        import javax.swing.JPanel;
        import javax.swing.JScrollPane;

        public class JScrollBarTest {

          public static void main(String[] args) {
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            JPanel p = new JPanel(new BorderLayout());
            JList l = new JList();
            DefaultListModel dlm = new DefaultListModel();
            for (int i = 0; i < 100; i++)
              dlm
                .addElement(i
                  + " asdjafljasdlfu earp9tuepr9g uepr9t7u " + "wiphdfkjvnasdasdlasdjalsdaksdhaksdhaskjdhaskdhakdhasfkhsadlfh");
            l.setModel(dlm);
            JScrollPane s = new JScrollPane(l);
            l.setSelectedIndex(99);
            l.ensureIndexIsVisible(99);
            p.add(s, BorderLayout.CENTER);
            f.getContentPane().add(p);
            f.pack();
            f.setSize(new Dimension(200, 400));
            f.setVisible(true);
          }

        }

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

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

              alexp Alexander Potochkin (Inactive)
              ndcosta Nelson Dcosta (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: