table.getColumnModel().getColumn(1).setPreferredWidth(30);
table.getColumnModel().getColumn(2).setPreferredWidth(50);
table.getColumnModel().getColumn(3).setPreferredWidth(50);
table.getColumnModel().getColumn(4).setPreferredWidth(20);
table.getColumn(model.getColumnName(0)).setCellRenderer(new DefaultTableCellRenderer() {
public Component getTableCellRendererComponent(final JTable table,
final Object value,
final boolean isSelected,
final boolean hasFocus,
final int row,
final int column) {
File renderingFile = (File)getModel().getElementAt(row);
String displayValue = getFileChooser().getName(renderingFile);
JLabel result = (JLabel)super.getTableCellRendererComponent(table, displayValue, isSelected, hasFocus, row, column);
result.setIcon(getFileChooser().getIcon(renderingFile));
return result;
}
});
table.getColumn(model.getColumnName(1)).setCellRenderer(new DefaultTableCellRenderer() {
public Component getTableCellRendererComponent(final JTable table,
final Object value,
final boolean isSelected,
final boolean hasFocus,
final int row,
final int column) {
JLabel result = (JLabel)super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
result.setHorizontalAlignment(SwingConstants.RIGHT);
return result;
}
});
table.getColumn(model.getColumnName(3)).setCellRenderer(new DefaultTableCellRenderer() {
public Component getTableCellRendererComponent(final JTable table,
final Object value,
final boolean isSelected,
final boolean hasFocus,
final int row,