This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes how to put ImageIcon in JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "how to put ImageIcon in JTable" Watch "how to put ImageIcon in JTable" New topic
Author

how to put ImageIcon in JTable

Bo Ling
Greenhorn

Joined: Oct 27, 2003
Posts: 5
Does the DefaultTableCellRender take care of displaying ImageIcon ? My table model has the getColumnClass defined.

Thanks
Don Kiddick
Ranch Hand

Joined: Dec 12, 2002
Posts: 580
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.
 
subject: how to put ImageIcon in JTable
 
Similar Threads
How to add ImageIcon for a element in a jtree?
Want to display image along with text in MenuItem
images in JList
how to display an image for window icon in Swings
Swing: Using icon resources in a jar