I want to have a JTable
for representing a CSV file with both row as well as column headers, just like MS Excel provides, which are initially set as att1
, att2
, att3
(for column headers) and row1
, row2
, row3
(for row headers). I need to have such an interface where header values could be set if they are already present in a file.
If the first column contains header values,then instead of row1
, row2
, row3
, given values could be set as row headers, and, if the first row contains header values,then instead of att1
, att2
, att3
given values could be set for column.
I don't know how to do the same with row. for columns,
String[] hname = new String[dm.getColumnCount()];
for(int j=0;j<dm.getColumnCount();j++)
{
hname[j]=dm.getValueAt(0, j).toString();}
dm.removeRow(0);
Vector<String> v = new Vector<String>(Arrays.asList(hname));
dm.setDataVector(dm.getDataVector(), v);