Hi.
I am trying to implement a custom behavior on the copy command on
jtable.
Basically I force the entire row to be selected when a user is working
with myJtable. I feel this is a good design because it allows the user
to quickly see what they are working with, without a doubt.
However I would like to customize the copy command on the jtable
because some of the items in the row are images, which I would not like
to allow the user to copy (it gets converted into text, and it looks
ugly!).
What I would like to do is have the copy command ignore the columns
with the images in them, and only copy the textual columns. Im not
sure how to go about doing this, does anyone have any insight for me?
Thanks!
oulan bator - 28 Nov 2005 15:53 GMT
Hi,
jtable store its actions in "ActionMap", copy is called "copy" (I
think so, you can check it easily in a debugguer), then :
1- write your own action
Action a = " your action"
jtable.getActionMap().put("copy",a);
and that's all ...
BR
zero - 28 Nov 2005 15:57 GMT
"tiewknvc9" <aotemp@hotmail.com> wrote in news:1133191665.983414.267130
@g47g2000cwa.googlegroups.com:
> Hi.
>
[quoted text clipped - 15 lines]
>
> Thanks!
How about something like this
for(int i = 0; i < numColumns; i++)
{
Class colClass = table.getColumnClass(i);
if(colClass.getName().contains("Image")
continue;
// else
// copy the data
}
There may be a better way to code this, but the basic idea is just to get
the type of each column, and then act accordingly.

Signature
Beware the False Authority Syndrome