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

JList selection Criteria not working properly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.2.2
    • client-libs
    • beta
    • x86
    • windows_nt



      Name: krT82822 Date: 02/29/2000


      java version "1.2.2"
      Classic VM (build JDK-1.2.2-W, native threads, symcjit)

      I have a JList with selection type of ListSelectionModel.SING]LE_SELECTION. The
      selection model works properly with using SHIFT + ArrowKey and CTLR and
      selecting another item. It does not work when using SHIFT + Page UP or SHIFT +
      Page Down. It selects everything it should as well as changing the main
      selected item.

      -------------

      (see also 4140619, 4196969)

      29 Feb 2000, eval1127@eng -- verified on kestrel-rc1. Use the left-hand-side list in the following case to see the problem

      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;
      import javax.swing.border.*;

      public class TestCaseToo extends JFrame {
        JList list1;

        public TestCaseToo() {
          String testList[] = new String[45];

          for (int i = 0 ; i < 45 ; i++) {
            testList[i] = "Item " + Integer.toString(i);
          }

          JScrollPane scrollPane1 = new JScrollPane(list1 = new JList(testList),
                                                    JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                                                    JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);

              list1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

          JPanel panel1 = new JPanel();
          panel1.setLayout(new BorderLayout());
          panel1.add(scrollPane1, BorderLayout.CENTER);
          panel1.setPreferredSize(new Dimension(120, 150));

          JScrollPane scrollPane2 = new JScrollPane(list2 = new JList(testList),
                                                    JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                                                    JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);

          JPanel panel2 = new JPanel();
          panel2.setLayout(new BorderLayout());
          panel2.add(scrollPane2, BorderLayout.CENTER);
          panel2.setPreferredSize(new Dimension(120, 150));

          JPanel mainPanel = new JPanel();
          mainPanel.setLayout(new GridLayout(1,2));
          mainPanel.add(panel1);
          mainPanel.add(panel2);

          Container contentPane = getContentPane();
          contentPane.setLayout(new BorderLayout());
          contentPane.add(mainPanel, BorderLayout.CENTER);

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

          setTitle("TestCaseToo");
          pack();
          setVisible(true);
        }

        public static void main(String[] args) {
          TestCaseToo window = new TestCaseToo();
        }
      }

      (Review ID: 101877)
      ======================================================================

            pmilnesunw Philip Milne (Inactive)
            kryansunw Kevin Ryan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: