Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6728636

Synth table renderer insets is changed since 6u10

    Details

    • Subcomponent:
    • Introduced In Version:
    • CPU:
      generic
    • OS:
      generic

      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);
        }
      }

        Attachments

          Activity

            People

            • Assignee:
              peterz Peter Zhelezniakov (Inactive)
              Reporter:
              ryeung Roger Yeung (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: