Duplicate :
|
spec says: http://java.sun.com/javase/6/docs/api/javax/swing/JTable.html#getIntercellSpacing() getIntercellSpacing public Dimension getIntercellSpacing() Returns the horizontal and vertical space between cells. The default spacing is (1, 1), which provides room to draw the grid. Returns: the horizontal and vertical spacing between cells See Also: setIntercellSpacing(java.awt.Dimension) but instead method returns (0,0) by default. minimal test case: import javax.swing.*; import javax.swing.table.*; public class Test{ public static void main(String[] args){ JTable c = new JTable(); // step Create JTable object int cl_num = c.getColumnCount(); int r_num = c.getRowCount(); TableColumn tc = new TableColumn(); Object id = new Object(); tc.setIdentifier(id); c.addColumn(tc); if (c.getIntercellSpacing().width == 1);else System.out.println("c.getIntercellSpacing().width == 1 failed; c.getIntercellSpacing().width="+c.getIntercellSpacing().width); if (c.getIntercellSpacing().height == 1);else System.out.println("assertion c.getIntercellSpacing().height == 1 failed; c.getIntercellSpacing().height="+c.getIntercellSpacing().height); System.out.println("Finished"); } } execution: C:\tests\JTable>C:\JDK\jdk1.6.0_10\bin\java.exe -Dswing.defaultlaf=com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel Test c.getIntercellSpacing().width == 1 failed; c.getIntercellSpacing().width=0 assertion c.getIntercellSpacing().height == 1 failed; c.getIntercellSpacing().height=0 Finished C:\tests\JTable>C:\JDK\jdk1.6.0_10\bin\java.exe Test Finished