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: Closed
  • Resolution: Won't Fix
  • OS: generic
  • CPU: generic
  • Submitted: 2008-07-22
  • Updated: 2019-12-17
  • Resolved: 2019-12-17
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
25-09-2008