Skip to main content

Synth table renderer insets have been changed

1 reply [Last post]
wzberger
Offline
Joined: 2004-08-31

In Java 6u10 the default renderer insets differ from previous releases. With recent Java 6 and Java 1.5 the insets are 1,1,1,1 with Java 6u10 the renderer insets are 0,0,0,0.

Test case:

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

Thanks,
Wolfgang

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
rogyeu
Offline
Joined: 2006-07-30

Thanks for reporting the issue. I have opened a bug report to track this issue. The bug ID is 6728636. It may take a day or 2 for the bug to show up here:
http://bugs.sun.com/view_bug.do?bug_id=6728636

Thanks,
Roger Y.