• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTable - custom JTableHeader with UP, DOWN sorting icon

Giri Thava
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
class MyHeaderRenderer extends DefaultTableCellRenderer {
public MyHeaderRenderer() {
setIcon(new ImageIcon("1.png"));

RowSorter<TableModel> sorter = new TableRowSorter<TableModel> (tableModel);
table.setRowSorter (sorter);
table.getColumnModel().getColumn(2).setHeaderRenderer(new MyHeaderRenderer());

After setting a custom header renderer, the default UP and DOWN sort image
is not displaying in the table header. How can I show those images.

Thanks in advance
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic