JDK-6728636 : Synth table renderer insets is changed since 6u10
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6u10
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • OS: generic
  • CPU: generic
  • Submitted: 2008-07-22
  • Updated: 2011-04-28
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
6-poolUnresolved
Description
The synth table renderer inset is changed in 6u10 compare to any previous release.

To reproduce: 
Run the followin code in 6u10 and other release earlier than 6u10, say 6u6. Observe that the insets results are different. 6u10 has 0 and 6u6 has 1.

import javax.swing.plaf.synth.*;
import javax.swing.*;
import java.awt.*;
import java.io.*;
import javax.swing.table.*;


public class SynthTableTest extends JFrame
{
  private static String synthXml = "<synth>" +
  "  <style id=\"table\">" +
  "    <state>" +
  "      <color type=\"BACKGROUND\" value=\"#FFFFFF\" />" +
  "      <color type=\"FOREGROUND\" value=\"#000000\" />" +
  "    </state>" +
  "    <state value=\"SELECTED\">" +
  "      <color type=\"TEXT_BACKGROUND\" value=\"#0070C0\"/>" + 
  "    <color type=\"TEXT_FOREGROUND\" value=\"#FFFFFF\"/>" + 
  "    </state>" +   
  "  </style>" +
  "  <bind style=\"table\" type=\"region\" key=\"Table\"/>" +
  "</synth>";
  
  public static void main(String[] args)
  {
    EventQueue.invokeLater(new Runnable(){
      public void run()
      {
        try
        {
          new SynthTableTest();
        }
        catch (Exception e)
        {
          e.printStackTrace();
        }
      }
    });   
  }
 
  public SynthTableTest() throws Exception
  {
    InputStream is = new ByteArrayInputStream(synthXml.getBytes("UTF8"));
    SynthLookAndFeel laf = new SynthLookAndFeel();
    laf.load(is, SynthTableTest.class);
    UIManager.setLookAndFeel(laf);    
 
    String[][] data = new String[][]{{"Val11","Val12"},{"Val21","Val22"}};
    String[] columns = new String[]{"Column A", "Column B"};    
    JTable table = new JTable(data, columns);
    add(new JScrollPane(table));
    
    table.setDefaultRenderer(Object.class, new DefaultTableCellRenderer(){
      @Override
      public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
      {
        JLabel l = (JLabel)super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
        l.setText(getInsets().toString());
        return l;
      }
    });    
    
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setSize(new Dimension(600, 300));
    setLocationRelativeTo(null);
    setVisible(true);  
  }  
}

Comments
EVALUATION I reproduced this bug, the screnshots attached
2008-09-25