This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes String to Clipboard Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "String to Clipboard" Watch "String to Clipboard" New topic

String to Clipboard

Kintaro OHEE

Joined: May 15, 2003
Posts: 1
Hi folks,
How do U copy a String to the clipboard. Allowing a user to paste the copied String, into the notepad for example, with the combination of ctrl+v.
Gabriel White
Ranch Hand

Joined: Mar 02, 2003
Posts: 233
you can write the string to a file, if that is OK.
Tom Purl
Ranch Hand

Joined: May 24, 2002
Posts: 104
I didn't know this until a few minutes ago, but there's a standard clipboard class offered by Sun. Maybe this is what you're looking for.

Tom Purl<br />SCJP 1.4
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Clipboard oughtta do it. Here's a rather more advanced example enabling cut & paste between Excel and a Swing table.

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
I agree. Here's the link:
subject: String to Clipboard
It's not a secret anymore!