jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null},
{null, null, null},
},
new String [] {
class2.columnName[0],class2.columnName[1],class2.columnName[2]
}
));
Column names array In class2:
static String[] columnName={"Name", "data" , "data2"};
I want to set 3 Columns names in JTableJTable from String[]String[] Columns. I did this by using array index number by coded hard: but if I have hundreds of values in the array then how can Ii set jtable column names by using array values without using hardcoded array index numbers but by using any other less typing way