This is how it can be done:
JTable table;
DefaultTableModel model = new DefaultTableModel();
model.addColumn("Directory");
model.addColumn("Files");
table = new JTable(model);
JScrollPane scrollPane = new JScrollPane(table);
//Changes Collumn header text
table.getColumnModel().getColumn(0).setHeaderValue("After");
table.getColumnModel().getColumn(1).setHeaderValue("Before");
// Forces the header to resize and repaint itself
table.getTableHeader().resizeAndRepaint();
No comments:
Post a Comment