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 / March 2005

Tip: Looking for answers? Try searching our database.

Jtable content to system clipboard

Thread view: 
Marc Van Laer - 11 Mar 2005 01:49 GMT
Hi all,

I'm trying to copy a JTable to my system clipboard.
So far i've been unsuccesfull.
Has anyone done this before?
Is it even possible?

Thanks in advance,

Marc Van Laer
Roland - 11 Mar 2005 08:21 GMT
> Hi all,
>
[quoted text clipped - 6 lines]
>
> Marc Van Laer

To copy selected table rows, you can use Java's built-in support:

TransferHandler th = myTable.getTransferHandler();
if (th != null) {
    Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();
    th.exportToClipboard(myTable, cb, TransferHandler.COPY);
}

If you want to copy the entire table contents, you probably have to
write it yourself. Have a look at the source code of the nested class
TableTransferHandler in javax.swing.plaf.basic.BasicTableUI.
Signature

Regards,

Roland de Ruiter
  ___      ___
 /__/ w_/ /__/
/  \ /_/ /  \

Marc Van Laer - 11 Mar 2005 16:19 GMT
Thanks Roland,

This did the trick...Perfect

Much obliged,

Van Laer Marc


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.