JDK-6698630 : JTable grid lines do not show on Nimbus with JDK 6 Update 10
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6u10
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2008-05-07
  • Updated: 2011-02-16
  • Resolved: 2008-06-27
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6u10 b26Fixed
Description
FULL PRODUCT VERSION :
java version "1.6.0_10-beta"
Java(TM) SE Runtime Environment (build 1.6.0_10-beta-b23)
Java HotSpot(TM) Client VM (build 11.0-b11, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Windows XP SP2

A DESCRIPTION OF THE PROBLEM :
Using the code below, the grid lines do not show at all. I applied all the suggestions from http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6594663, but this did not work. This also doesn't work on the Linux version of JDK6 U10.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
(Compile and run the source code provided)

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Black grid lines of 1 pixel thickness between each cell in the table.
ACTUAL -
No grid lines.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
public class JTableTest {

    public static void main(String[] args)
    {
        try
        {
            UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
        } catch (Exception ex) {}

        JTable table = new JTable(new Object[][] {
                                                    {"Mary", "Campione",
                                                     "Snowboarding", new Integer(5), new Boolean(false)},
                                                    {"Alison", "Huml",
                                                     "Rowing", new Integer(3), new Boolean(true)},
                                                    {"Kathy", "Walrath",
                                                     "Knitting", new Integer(2), new Boolean(false)},
                                                    {"Sharon", "Zakhour",
                                                     "Speed reading", new Integer(20), new Boolean(true)},
                                                    {"Philip", "Milne",
                                                     "Pool", new Integer(10), new Boolean(false)}
                                                 },
                                  new Object[] {"First Name",
                                                "Last Name",
                                                "Sport",
                                                "# of Years",
                                                "Vegetarian"});
        
        table.setGridColor(Color.BLACK);
        table.setIntercellSpacing(new Dimension(1, 1));
        table.setShowGrid(true);
        
        
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.add(table);
        frame.pack();
        frame.setVisible(true);
        
                
    }
}
---------- END SOURCE ----------

Comments
EVALUATION I can reproduce the bug on Windows, and I can see the source of the bug in the SynthTableUI class. Both intercell spacing and showGridLines are being replaced by SynthTableUI regardless of the settings of the user. Note that if the user moves the lines that adjust the table properties to after the "pack()" call, it will work (until such time as Synth decides to update the table, at which time those customizations will be lost). I'm now working on testing the fix.
29-05-2008

EVALUATION I cannot reproduce the bug on Solaris x86, which is curious since the submitter said it failed on Windows and Linux (and Linux & Solaris should have no practical differences in this regard. Likewise, as far as Nimbus is concerned with rendering, Windows & Solaris shouldn't have any practical differences).
29-05-2008