File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in JTable

 
Vishal Methi
Ranch Hand
Posts: 52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible in JTable to change the size of a particular row. Actually i have with 10 rows and 10 columns and i want the size of 4th and 8th smaller than other rows......... plz suggest me asap...........
Thanx
Vishal
 
Jason Steele
Ranch Hand
Posts: 100
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you would have to extend JLabel and implement DefaultTableModel
or extend AbstractTableModel. Preferrable the second option.

Then in the getTableCellRendererComponent method, test to see if you are in row 4 or 8...or better yet row % 4 == 0. If it is, then call setPreferredSize on that label to be the size you desire.


Good Luck!
 
Jose Botella
Ranch Hand
Posts: 2120
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JTable.setRowHeight(row, rowHeight) is another possibility.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic