• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can JTable support hide or display a certain of rows?

 
Walt Deng
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if the DefaultTableModel has five rows,but i want to display two rows only,how can i do?i don't want to use the fireTableRowsDeleted(int firstRow,int lastRow) or removeRow(int row),because i need these later.now i solve like below:
1 create a MyTableModel implements Cloneable
2 once i need certain display,i clone a MyTableModel object,so i use fireTableRowsDeleted(int firstRow,int lastRow) or removeRow(int row) based my conditions with cloned object,then setModel use the model.
it can run,but lack performance.how can i do?
 
kim jungil
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
u can use setRowCount() to control your table row's count
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!