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

unix: JTable does not redraw it's row correctly after setRowSelectionAllowed cal

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.3.0
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:

      Description



      Name: iaR10016 Date: 05/19/2000



      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 raw 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,
      although they should be not coloured.

      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();
          aPane.add(aTable);
          Button aButton = new Button("Change");
          aButton.addActionListener(this);
          aPane.add(aButton);
          add(aPane);
        }

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

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

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

      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              pmilnesunw Philip Milne (Inactive)
              Reporter:
              irasunw Ira Ira (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: