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

Spec does not define current highlighting of fields when selection is toggled



      JDK version:
      java version "1.3.0beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0beta-b05)
      Classic VM (build 1.3.0beta-b05, green threads, nojit)

      The following test example creates a frame window, that contains JTable component
      and "Change" button. By button clicking you can invert RowSelectionAllowed property
      of the table.

      To reproduce the bug do the following steps:

      1. When row selection is allowed, select some table cell, for example, upper left table cell. Upper row is selected and coloured.
      2. Click the "Change" button. RowSelectionIsAllowed is false now.
      3. Select the left upper table cell. Two right upper cells remains coloured,
      the spec does not seem to define what should be done.

      This bug is reproducable in Linux JDK 1.3 and Solaris JDK 1.3.

      JCK 1.3 runtime test /api/javax_swing/interactive/JTableTests fails because of this bug.

      ---------------------------- test.java --------------------------------------------

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

      public class test extends Frame implements ActionListener {
        JTable aTable;

        public void init() {
          TableModel dataModel = new AbstractTableModel() {
                public int getColumnCount() { return 3; }
                public int getRowCount() { return 5; }
                public Object getValueAt(int row, int col)
                       {return new Integer(row*col);}
          aTable = new JTable(dataModel);
          JPanel aPane = new JPanel();
          Button aButton = new Button("Change");

        public static void main(String[] args) {
           test aFrame = new test();
           aFrame.setSize(new Dimension(500,150));

        public void actionPerformed(ActionEvent e) {
          aTable.setRowSelectionAllowed( ! aTable.getRowSelectionAllowed());
          if (aTable.getRowSelectionAllowed()) setTitle("Row selection is allowed");
          else setTitle("Row selection is not allowed");


          Issue Links



              • Assignee:
                apikalev Andrey Pikalev
                jdixonsunw John Dixon (Inactive)
              • Votes:
                0 Vote for this issue
                1 Start watching this issue


                • Created: