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 Pasting image in JTable cells Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Pasting image in JTable cells" Watch "Pasting image in JTable cells" New topic

Pasting image in JTable cells

Shaik Muhammad
Ranch Hand

Joined: Jul 16, 2008
Posts: 36
I am unable to paste an image in the table cells. i am using cell rendered still am not getting the image.
Please look at my code

Please help

[edit]Add Code Tags. CR[/edit]
[ September 06, 2008: Message edited by: Campbell Ritchie ]
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46320
Please find the Code Button; I have edited your post so you can see how much easier it is to read.
This sounds a specifically Swing-related issue, so I shall move you to the Swing forum.
Brian Cole
Ranch Hand

Joined: Sep 20, 2005
Posts: 878
First, you shouldn't need to use a custom renderer
to show an image. The functionality is built-in.
All you need to do is return Icon.class (or
ImageIcon.class, either works) from your table
model's getColumnClass() method.

Second, what do you mean by pasting an image? If you
mean pasting from the clipboard (a la Ctrl-V) then it
will take a little work. It would probably be easiest
to create a class to pass to setTransferHandler().

bitguru blog
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535

Geek Images
I agree. Here's the link:
subject: Pasting image in JTable cells
It's not a secret anymore!