Column names in DefaultTableModel

How to create DefaultTableModel with column names and no rows added to it? The rows ll get added only after clicking the button.....
[139 byte] By [mikkua] at [2007-11-27 0:49:53]
# 1

DefaultTableModel has a constructor

DefaultTableModel(Object[][] data, Object[] columnNames)

So just call that and pass null

as the first argument.

E.G.

DefaultTableModel rowLessModel = new DefaultTableModel(null,ArrayOfColumnNames);

Hope that helps

Ruanaea at 2007-7-11 23:19:40 > top of Java-index,Desktop,Core GUI APIs...