United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6728636 : Synth table renderer insets is changed since 6u10

Details
Type:
Bug
Submit Date:
2008-07-22
Status:
Open
Updated Date:
2011-04-28
Project Name:
JDK
Resolved Date:
Component:
client-libs
OS:
generic
Sub-Component:
javax.swing
CPU:
generic
Priority:
P3
Resolution:
Unresolved
Affected Versions:
6u10
Targeted Versions:
6-pool

Related Reports

Sub Tasks

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



Hardware and Software, Engineered to Work Together