Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy int[] to clipboard

Status
Not open for further replies.

whodaman

Programmer
May 23, 2001
60
CA
How do you copy an interger array to the clip board? What I found was to copy a StringSelection into the clipboard as shown in the below code. But what I need to do is to put an interger array to the clipboard.

public void copyToClipBoard()
{
Clipboard cb = getToolkit().getSystemClipboard();
StringSelection contents = new StringSelection("HI");
cb.setContents(contents, this);
}

public void lostOwnership(Clipboard cb, Transferable contents) {}


I don't know what data type I sould convert the interger array to in order to use the command
cb.setContents(contents, this);

Thanks for your time :)
 
It seems like there are no current class or methods that allow you to add an Integer array to a ClipBoard object. So I suggest that you can write your own class that implements ClipboardOwner and Transferable or to insert the entire contents of the Integer Array as a String instead.

Hope this helps,
Leon If you need additional help, you can email to me at zaoliang@hotmail.com I don't guaranty that I will be able to solve your problems but I will try my best :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top