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

Linux: JTable does not redraw it's cells after setCellSelectionEnabled call

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      beta2
    • CPU:
      x86, sparc
    • OS:
      linux, solaris_7, windows_95
    • Verification:
      Verified

      Description



      Name: icR10030 Date: 10/16/2000



      Config:
      Linux RedHat 6.2
      Tests fail:
      api/javax_swing/interactive/JTableTests.html#JTableTest0009

      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 cell selection is allowed, select some table's cells.
      2. Click the "Change" button. setCellSelectionEnabled() will be called.
      3. After disabling cell selection, selection will not be redrawn.
      4. Cells selection will be redrawn after changing frame's size.

      This bug is reproducible in Linux 6.2 and ladybird.

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

      //---------------------------- test.java --------------------------------------------
      import java.awt.*;
      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.( ! aTable.getCellSelectionEnabled() );
          if (aTable.getRowSelectionAllowed()) setTitle("Row selection is allowed");
          else setTitle("Row selection is not allowed");
        }
      }
      //---------------------------- end test.java ----------------------------------------

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

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              svioletsunw Scott Violet (Inactive)
              Reporter:
              ichesunw Iche Iche (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: