Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2005

Tip: Looking for answers? Try searching our database.

custom jtable copy command?

Thread view: 
tiewknvc9 - 28 Nov 2005 15:27 GMT
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



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.