setting border of Jtable to null

hi,I want to set the border of every cell of Jtable to Null, I have used setBorder(BorderFactory.createEmptyBorder());thanx
[151 byte] By [p_more_javaa] at [2007-11-26 19:17:14]
# 1

That's not the border. Borders go around the outside edges of a component.

I think you are referring to a table's "grid lines". They can be removed by

using setShowGrid:

import javax.swing.*;

public class TableExample implements Runnable {

public void run() {

JTable table = new JTable(30,10);

table.setShowGrid(false); //<<--

for(int r=0; r<table.getRowCount(); ++r)

for(int c=0; c><table.getColumnCount(); c++)

table.setValueAt(new Integer(r*c), r, c);

JFrame f = new JFrame();

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.getContentPane().add(new JScrollPane(table));

f.pack();

f.setLocationRelativeTo(null);

f.setVisible(true);

}

public static void main(String[] args) {

SwingUtilities.invokeLater(new TableExample());

}

}

There are also methods setShowVerticalLines/setShowHorizontalLines

if you want to see only one set of grid lines.>

DrLaszloJamfa at 2007-7-9 21:31:12 > top of Java-index,Java Essentials,New To Java...
# 2
thanx
p_more_javaa at 2007-7-9 21:31:12 > top of Java-index,Java Essentials,New To Java...