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

REGRESSION: JTree selection with RIGHT ARROW

    XMLWordPrintable

Details

    Description

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



      ADDITIONAL OS VERSION INFORMATION :
      Linux D31004219 2.6.24-19-generic #1 SMP Wed Jun 18 14:43:41 UTC 2008 i686 GNU/Linux


      A DESCRIPTION OF THE PROBLEM :
      The left arrow of a JTree behaves differently compared jdk1.5 with jdk1.6.

      In jdk1.5 I can walk the tree with the RIGHT arrow tree:
      - It always select the first child.
      - If the node doesn't have any children than the next child of the node's parent is chosen.

      In jdk1.6:
      - It always selects the first child.
      - If the node doesn't have any children than the same node stays selected.

      I looked in the sourcecode and indeed there is a difference:
      In jdk1.5 the code is:

                             if(!ui.isLeaf(minSelIndex) &&
                                 !tree.isExpanded(minSelIndex)) {
                                  ui.toggleExpandState(ui.getPathForRow
                                                    (tree, minSelIndex));
                                  newIndex = -1;
                              }
                              else
                                  newIndex = Math.min(minSelIndex + 1, rowCount - 1);

      In jdk1.6 the code is:
                              if (!ui.isLeaf(minSelIndex)) {
                                  if (!tree.isExpanded(minSelIndex)) {
                                      ui.toggleExpandState(minSelPath);
                                  }
                                  else if (childCount > 0) {
                                      newIndex = Math.min(minSelIndex + 1, rowCount - 1);
                                  }
                              }



      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      You can just try the SwingSet2 demo in jdk1.5 and jdk 1.6.

      - Select the Tree demo.
      - Select the first node.
      - Keep pressing the RIGHT ARROW key.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The expected result is that you can traverse the whole tree with the RIGHT ARROW key.
      So at the end the last node is selected.
      ACTUAL -
      In jdk1.5 the tree is traversed and the last node is selected.
      In jdk1.6 the tree stops traversing when the first leaf of the tree is selected.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      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.

      Attachments

        Activity

          People

            alexp Alexander Potochkin (Inactive)
            igor Igor Nekrestyanov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: