United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6698630 : JTable grid lines do not show on Nimbus with JDK 6 Update 10

Details
Type:
Bug
Submit Date:
2008-05-07
Status:
Closed
Updated Date:
2011-02-16
Project Name:
JDK
Resolved Date:
2008-06-27
Component:
client-libs
OS:
windows_xp
Sub-Component:
javax.swing
CPU:
x86
Priority:
P4
Resolution:
Fixed
Affected Versions:
6u10
Fixed Versions:
6u10 (b26)

Related Reports

Sub Tasks

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 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).
                                     
2008-05-29
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.
                                     
2008-05-29



Hardware and Software, Engineered to Work Together