JListBox.removeSelectionInterval() does not remove slections

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P2
    • 0.9
    • Affects Version/s: 1.1.2
    • Component/s: client-libs
    • None
    • 0.9internal
    • sparc
    • solaris_2.5.1
    • Verified

      The following code shows that JListBox.removeSelectionInterval() does
      not remove selections. It selects the indices that you want to have
      removed and deselects the previously selected indices.

      import java.awt.*;
      import java.awt.event.*;
      import com.sun.java.swing.*;

      public class listbox1

      {
          public static void main(String[] args)
              {
                  String strings[] = { "zero", "one", "two", "three", "four" };
                  final JListBox listbox = new JListBox( strings );
                  JPanel p = new JPanel();
                  p.setLayout(new GridLayout(1,1));
                  p.add(listbox);

                  listbox.addSelectionInterval(0,1);

                  // bug: The following code deselects indices 0 and 1, and
                  // selects indices 2 and 3 instead.
                  listbox.removeSelectionInterval(2,3);

                  WindowListener l = new WindowAdapter() {
                      public void windowClosing(WindowEvent e) {System.exit(0);}
                  };

                  JFrame f = new JFrame("ListBox");
                  f.addWindowListener(l);
                  f.add(p);
                  f.pack();
                  f.show();
              }
      }

            Assignee:
            Btplusnull User (Inactive)
            Reporter:
            Tracy Barbaro (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: