This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Paste inserts 2 copies of clipboard Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Paste inserts 2 copies of clipboard" Watch "Paste inserts 2 copies of clipboard" New topic
Author

Paste inserts 2 copies of clipboard

David A. Smith
Greenhorn

Joined: Sep 08, 2010
Posts: 9

Hi all,

I have a text field that I want to support the ^C and ^V conventions for copy and paste. The problem is that I get *two* copies of whatever was in the clipboard. The code is so simple that I would think there's not much to go wrong. But clearly I'm wrong... Anyway, the JVM is 1.6.0_18 on a Linux box.

Here's the code:



Thanks,

Dave.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4642
    
    5

The copy,cut,selectAll and paste actions are already supported via key bindings. In reinventing the wheel, you've ended up with a bicycle.
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2204
    
    7
Darryl Burke wrote:In reinventing the wheel, you've ended up with a bicycle.


I like that
David A. Smith
Greenhorn

Joined: Sep 08, 2010
Posts: 9

Okay, thanks...? I'll have to try on different versions/platforms. I'm getting inconsistent behaviors and reports from some users that it doesn't work. (Perhaps an older JDK behaves differently...) Still, thanks for the (humorous!) reply.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Paste inserts 2 copies of clipboard