File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes right click on the browser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "right click on the browser" Watch "right click on the browser" New topic
Author

right click on the browser

shipra sarkar
Greenhorn

Joined: Apr 16, 2001
Posts: 3
I have a image on my html page.I want the copy option to be disabled when the user right clicks on the image in the html page.
how can that be done
please help
ken chou
Ranch Hand

Joined: Feb 08, 2001
Posts: 68

I know you can use Javascript to do that. If it's just a html page, not java applet, I doubt about you can do it in Java.
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Simply pass the image into the applet and do a g.drawImage( image ) in the applet's paint method... the user then cannot right click on the image and save it, since they are not clicking on an image anymore, but a Java applet. However, this does not stop someone from simply viewing the code of your webpage or your applet to find the filename of the image and downloading it directly. You may be able to put your images in a non-public directory to prevent this, but then I am not sure if the applet could access them either.
However, Ken's suggestion is probably right... this is probably better suited to JavaScript than Java...
And here's another question... if you don't want users to download an image, why are you putting on the internet? Every time a browser connects to your page, that image is downloaded to the users computer anyway... they just have to wade through all the browser files to find it... and as long as an image is displayed on the screen the user can take a screenshot and save your image that way...
HTH,
-Nate


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
ken chou
Ranch Hand

Joined: Feb 08, 2001
Posts: 68
I totally agree with Nathan. I keep wondering the reason why you are trying to do that when I read your question?
[This message has been edited by ken chou (edited April 18, 2001).]
 
Don't get me started about those stupid light bulbs.
 
subject: right click on the browser