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

JList.setSelectedIndex does not highlight item in list.

XMLWordPrintable

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

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

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      I'm using a laptop with a second monitor.

      A DESCRIPTION OF THE PROBLEM :
      I ran the FileChooserDemo that comes with the jdk1.5.0_04. I set the look and feel to windows, set the button on the left to "Save", and clicked the "Show FileChooser" button. I have a data inspector tool that lets me find GUI objects and call their methods, etc. I called setSelectedIndex on the sun.swing.FilePane$3 that shows the Files. It did not highlight the selection, though the same call in j2re1.4.2_08 does. I subsuquently called getSelectedIndex in 1.5.0_04 and the selection I'd made was returned. I clicked the "Save" button and the folder I'd picked was opened. So it looks like it's just a matter of highlighting. I see that sun.swing.FilePane$3 inherits directly from javax.swing.JList and does not redefine any of its methods, however I tried the same sort of proceedure on a plane JList in SwingSet2 and it worked just fine.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      I guess you could alter the code of the FileChooserDemo to call setSelectedIndex and see that the item doesn't get highlighted.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      sun.swing.FilePane$3.setSelectedIndex should highlight the item selected. It does in j2re1.4.2_08.
      ACTUAL -
      sun.swing.FilePane$3.setSelectedIndex does not highlight the item selected when using jre1.5.0_04.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      Comes with the JDK; it just needs a little alteration.
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      I don't know of one.

      Impact: We make an automated testing tool, and our customers who may use this class will need to be told that the item is being selected even though it doesn't look like it.

            leifs Leif Samuelsson (Inactive)
            jssunw Jitender S (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: