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

java.awt.List.select(int) toggles selection in Solaris

XMLWordPrintable

    • sparc
    • solaris_2.5.1



      Name: joT67522 Date: 11/04/97


      When a List is in multiple select mode, the select
      method is supposed to be ignored if the specified
      List item is already selected. This is the case in
      the Windows and OS/2 JDKs. However, with Solaris
      the select method toggles the selection. See the
      code below.

      *************************************************

      /*
      Demonstrates that in Solaris List.select() toggles the selection
      in a multipleMode List. */

      import java.awt.*;
      import java.awt.event.*;

      class ListSelectTest extends Frame {
         List list = new List();
         Button button = new Button("OK");

         public static void main(String[] args) {
            new ListSelectTest();
         }

         ListSelectTest() {
            setSize(300,200);
            setLayout(new BorderLayout());
            add("Center",list);
            add("South",button);

            list.setMultipleMode(true);
            list.addItem("First");
            list.addItem("Second");
            list.addItem("Third");

            button.addActionListener(new ActionListener() {
               public void actionPerformed(ActionEvent ev) {
                 list.select(1); //select the second row
                 //Toggles in Solaris
               }
            });
            setVisible(true);
         }
      }
      (Review ID: 19299)
      ======================================================================

            mbronsonsunw Mike Bronson (Inactive)
            johsunw Joon Oh (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: