Reputation: 91
I have code like below:
table_1 = new JTable();
table_1.setModel(new DefaultTableModel(
new Object[][] {
{null, null, null, null, null, null, null},
},
new String[] {
"Product Code", "Description", "Price", "Quantity", "Total ", "Discount", "Remarks"
}
));
I want to see column header names. I tried with this code, but I cant see the names. I want to know how to do that?
Also, I also want to set the cell value which is coming from a JTextField
.
Upvotes: 1
Views: 343
Reputation: 7126
The column names won't show up until you add table_1
to a JScrollPane
, like they show in the tutorial.
Upvotes: 4