Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pasting image in JTable cells

 
Shaik Muhammad
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 49782
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Author
Ranch Hand
Posts: 908
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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().
 
Craig Wood
Ranch Hand
Pie
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Geek Images
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic