File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "how to put ImageIcon in JTable" Watch "how to put ImageIcon in JTable" New topic

how to put ImageIcon in JTable

Bo Ling

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

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 !
[ February 25, 2004: Message edited by: Don Kiddick ]
I agree. Here's the link:
subject: how to put ImageIcon in JTable
Similar Threads
images in JList
how to display an image for window icon in Swings
Want to display image along with text in MenuItem
How to add ImageIcon for a element in a jtree?
Swing: Using icon resources in a jar