wood burning stoves 2.0*
The moose likes GWT and the fly likes Copying image to clipboard Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » GWT
Bookmark "Copying image to clipboard" Watch "Copying image to clipboard" New topic
Author

Copying image to clipboard

jasdeep parmar
Greenhorn

Joined: Oct 06, 2008
Posts: 20
Hi,

I am using smartgwt 2.2 for my application. I have customized context menu on right click on an image, I need to add a copy to systems clipboard functionality so i can copy an image from app then paste in somewhere else like (paint) . Is there a way I can accomplish it?

thanks
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10167
    
    8

Why are you writing your own functionality for this? Doesn't the browser provide this already?


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
jasdeep parmar
Greenhorn

Joined: Oct 06, 2008
Posts: 20
the reason I am writing my own is becuause i have to provide other customized options in that menu which browser doesn't provide..

thanks
salvin francis
Ranch Hand

Joined: Jan 12, 2009
Posts: 917

if it helps:

javascript for copying image from a div

var div = document.getElementById('divId');
div.contentEditable = 'true';
var controlRange;
if (document.body.createControlRange) {
controlRange = document.body.createControlRange();
controlRange.addElement(div);
controlRange.execCommand('Copy');
}
div.contentEditable = 'false';

I dont think this will work in non IE browsers and i advise against using browser specific script.

Always remember that you are working on a browser, Its never going to act like a desktop application,
You cannot (for example) drag and drop files from your pc into your application.


My Website: [Salvin.in] Cool your mind:[Salvin.in/painting] My Sally:[Salvin.in/sally]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Copying image to clipboard
 
Similar Threads
Copying Images to System Clipboard (in JDK1.1.x)
Copying image to the system clipboard
Copying Images to the System Clipboard (Java 1.1.x)
Capturing an image to system clipboard
control of PrtScr key through java