copy/paste : Java Glossary

copy/paste

In most Windows apps, you can copy a snippet of selected text to the clipboard with Ctrl-C. You can then paste it somewhere else with Ctrl-V. You can copy and delete in one operation with Ctrl-X. Java AWT (Advanced Windowing Toolkit) apps and Applets support copy/paste without writing any code, as do Java Swing apps.

Ostensibly to close security holes, As of JDK (Java Development Kit) 1.6.0_24, Java Swing JApplets do not support copy/paste, (Ctrl-C/Ctrl-V in Windows) unless you sign the Applet.

You can access the clipboard as a whole in signed Swing JApplets using code similar to this ClipboardPoker code part of the common11 package.

Making Ctrl-C/Ctrl-V Work Again

What can you do to make ordinary Ctrl-C/Ctrl-V work with unsigned Swing Applets in JDK 1.6.0_24+?

Why did Oracle do this?

Here is my speculation: Ctrl-C and Ctrl-V should be completely safe. The program cannot use them to sneakily peek at the clipboard without the user knowing. They are handled without application program involvement. However Copy/Paste menu buttons can, since the program intervenes, and can trigger the same actions even without user input. It could be handled two ways. Let Ctrl-C and Ctrl-V work always and the buttons only work when signed, or they could have everything work only when signed. Oracle chose consistency over convenience.


CMP homejump to top You can get the freshest copy of this page from: or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror)
http://mindprod.com/jgloss/copypaste.html J:\mindprod\jgloss\copypaste.html
logofeedback Please email your feedback for publication, letters to the editor, errors, omissions, typos, formatting errors, ambiguities, unclear wording, broken/redirected link reports, suggestions to improve this page or comments to Roedy Green : feedback email If you want your message kept confidential, not considered for posting, please explicitly specify that.
mindprod.com IP:[65.110.21.43]
view BlogYour face IP:[38.107.179.213]
You are visitor number 11.