It's not a secret anymore!*
The moose likes Swing / AWT / SWT and the fly likes Copying JTable's data to clipboard in Unix/Linux Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Copying JTable Watch "Copying JTable New topic

Copying JTable's data to clipboard in Unix/Linux

prav semilo

Joined: Apr 21, 2009
Posts: 2
Hi All,

I have written some code to copy rows selected from a JTable via mouse and copied via Ctrl + C. These rows and their columns are formatted to a string and copied to the system clipboard.

This code works fine in windows. I am able to paste the data from clipboard to notepad.

However this code doesn't work well with linux. Although the System.out.println() statements tell that the data is copied to the system clipboard, but trying to do a Ctrl+V or shift+insert doesn't seem to paste the data.

Has anyone ever tried to paste data to unix/linux's clipboard via java? Any help in this regard will be very much appreciated.

Following is the code that I wrote:

Rob Spoor

Joined: Oct 27, 2005
Posts: 19656

Please Use Code Tags.

How To Ask Questions How To Answer Questions
prav semilo

Joined: Apr 21, 2009
Posts: 2

I was able to copy the data to linux. I was trying to paste in the command window itself which is not possible. So I paste my test in firefox address bar(just to test my code) and I was able to paste it.

But now I have another problem. I will be accessing this applet via xterm on a windows machine(client machine, the original linux machine is the server) and I want to be able to copy this data to windows clipboard.

Has anyone ever tried to copy data from remote machines to client machine's clipboard? Any alternative strategies will also be appreciated.
I agree. Here's the link:
subject: Copying JTable's data to clipboard in Unix/Linux
Similar Threads
how to do copy/paste using swing
Copy and paste java objects using System clipboard
copy paste java object using System clipboard
Java Application on Citrix
problem while pasting images on to the java application from Mac Systemclipboard