JDK-6388576 : REGRESSION: in a JTable, first column header is white, should be grey
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2006-02-21
  • Updated: 2010-04-03
  • Resolved: 2006-02-22
Related Reports
Duplicate :  
Description
A DESCRIPTION OF THE REGRESSION :
When displaying a javax.swing.JTable, the first column header is a different colour, by default, the column headers should all be grey, as they are in jdk 1.5.06, but in
jdk-6-rc-b71, the first column header is white, when clicking on a row in the table, the column turns grey and stays that way.

Test:

created a frame, added a table to it with 5 rows and 2 columns, column's were labeled "column 1" and "column 2".


REPRODUCIBLE TESTCASE OR STEPS TO REPRODUCE:
Ran in Jbuilder, create a new project, create a new class called "mustangtest.Frame1", paste the following code over whatever was generated.  Class contains a main method, run the class using JDK 1.5.06, observe how the column headers look, change the JDK to jdk-6-rc-b71, run it again, and observe the differences.



package mustangtest;

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

public class Frame1
    extends JFrame {
  JPanel contentPane;
  BorderLayout borderLayout1 = new BorderLayout();
  JTable jTable1 = new JTable();
  javax.swing.table.DefaultTableModel model = new DefaultTableModel();

  protected JScrollPane scrollpane;

  public Frame1() {
    try {
      setDefaultCloseOperation(EXIT_ON_CLOSE);
      jbInit();
    }
    catch (Exception exception) {
      exception.printStackTrace();
    }
  }

  /**
   * Component initialization.
   *
   * @throws java.lang.Exception
   */
  private void jbInit() throws Exception {

    // The actual data values.
    Integer[][] data = new Integer[5][2];

    // Populate the data matrix.
    for (int row = 0; row < 5; row++) {
      for (int col = 0; col < 2; ++col) {
        data[row][col] = new Integer(1000000);
      }
    }
    model.setRowCount(5);
    // Configure the model with the data and column headers.
    model.setDataVector(data, new String[] {"Column 1", "Column 2"});

    jTable1.setAutoCreateColumnsFromModel(true);
    jTable1.setModel(model);
    contentPane = (JPanel) getContentPane();
    contentPane.setLayout(borderLayout1);

    scrollpane = new JScrollPane(jTable1);

    setSize(new Dimension(400, 300));
    setTitle("Mustang Test");
    contentPane.add(scrollpane, java.awt.BorderLayout.CENTER);
  }

  public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        try {
          UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        }
        catch (Exception exception) {
          exception.printStackTrace();
        }

        Frame1 frame = new Frame1();

        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        Dimension frameSize = frame.getSize();
        if (frameSize.height > screenSize.height) {
          frameSize.height = screenSize.height;
        }
        if (frameSize.width > screenSize.width) {
          frameSize.width = screenSize.width;
        }
        frame.setLocation( (screenSize.width - frameSize.width) / 2,
                          (screenSize.height - frameSize.height) / 2);
        frame.setVisible(true);

      }
    });
  }

}




RELEASE LAST WORKED:
5.0 Update 6

RELEASE TEST FAILS:
mustang-beta

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Table should be displayed in a frame with grey background for column headers "column 1" and "column 2".
ACTUAL -
Column header "column 1" is displayed with a white background, column header "column 2" is displayed with a grey background.  If you use the mouse to select a row in the table, the background of "column 1" will become grey.

Comments
SUGGESTED FIX Duplicate of 6388189, already fixed in Mustang b72.
22-02-2006