Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to put ImageIcon in JTable

 
Bo Ling
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does the DefaultTableCellRender take care of displaying ImageIcon ? My table model has the getColumnClass defined.

Thanks
 
Don Kiddick
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nope. but it should be fairly easy to enhance DefaultTableCellRenderer to do so.
Create a class ImageIconRenderer (or whatever) that extends DefaultTableCellRenderer.
Override the setValue method to

Register an instance of your new renderer to render ImagIcons using setDefaultRenderer.
that *should* do the trick !
D.
[ February 25, 2004: Message edited by: Don Kiddick ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic