I have written a simple program that creates an empty JTable. But when I display the Table an extra white space is visible below the Table.Now I want to remove that whitespace below the rows of table.
JTable Program:
public class Table extends JFrame {
Table()
{
int numColoumns=5;
int numRows=10 ;
String[] colHeadings = {"COLUMN1","COLUMN2","COLUMN3","COLUMN4","COLUMN5"};
DefaultTableModel model = new DefaultTableModel(numRows, numColoumns) ;
model.setColumnIdentifiers(colHeadings);
JTable table = new JTable(model);
JTableHeader head = table.getTableHeader();
Container c = getContentPane();
c.setLayout(new BorderLayout());
c.add("North", head);
c.add("Center",table);
}
public static void main(String[] args) throws NumberFormatException, IOException
{
Table t = new Table();
t.setSize(500,400);
t.setVisible(true);
t.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}}
The program gives me a table,but the rows are not filled completely to the window. It shows a window with given height and width in pixels and respective number of rows.Below the rows created it shows an extra space as the rows are not filled to the window. Can anyone help me in removing the extra space from the window.
Sorry I created an image of the output but there is a problem in uploading the image.