File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes menu cut & paste in applet 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 » Java » Applets
Bookmark "menu cut & paste in applet" Watch "menu cut & paste in applet" New topic
Author

menu cut & paste in applet

Martha Cofran
Greenhorn

Joined: Jan 31, 2001
Posts: 11
Hi,
I have a requirement to enable cut & paste from the menu in an applet. I have code that works in an applet viewer but not through the web server, although, cut & paste work on the web server when invoked with key combination (Ctl-C, Ctl-V, Ctl-X). I'm using the JTextComponent cut, copy, and paste methods in both cases, It think.
I assume the security manager is looking at where the event originated to determine access to the system clipboard, i.e. the control key combination is originating from swing (trusted code) and the menu event is originating from my code (untrusted code).
Is there a way to do this without modifying browser permissions? If not, I can go to a code base level permission scheme, but I'd rather not muck the browser permission if I don't have to.
Thanks for any help/advice you can give.
Angela Lamb
Ranch Hand

Joined: Feb 22, 2001
Posts: 156
Once again, if something works in appletviewer but not in the browser, the first thing to check is whether you are using a class/method that is not available in version 1.1(which most browsers use). JTextComponent is a Swing class, from Java 2, and is not supported in the browsers. If you look at the error message in the Java console in your browser, you should see a ClassNotFoundException that will alert you to the problem.
Martha Cofran
Greenhorn

Joined: Jan 31, 2001
Posts: 11
Well, I don't think so. JTextComponents are working fine in my browser with the exception of cut, copy, and paste through a menu. Cut, copy, and paste are working in my browser if I trigger the events from the keyboard. The exception I'm getting is a Permission error not a class not found error.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: menu cut & paste in applet
 
Similar Threads
applet works from command line but not in browser...
Problem in Image Loading in Swing Applet
jdbc applet works from command line but not on web page...
Accesing system clipboard in Applet
how to do copy/paste using swing