This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: menu cut & paste in applet
 
Similar Threads
how to do copy/paste using swing
Accesing system clipboard in Applet
jdbc applet works from command line but not on web page...
applet works from command line but not in browser...
Problem in Image Loading in Swing Applet