Click to See Complete Forum and Search --> : cannot catch security exception in applet


amazing_andr3
06-25-2005, 08:20 AM
typingArea is a textarea. This code will copy the text in appletviewer. When I run it in the browser, the text won't get copied because the applet doesn't have access to the clipboard.

Now the problem is that the catch statement doesn't work. There is no frame alerting the user!


try {
typingArea.copy();
} catch (SecurityException se) {// can't access clipboard
Frame frame = new Frame();
JOptionPane.showMessageDialog(frame, "The applet does not have access to the clipboard. You have to press CTRL + C to copy it.");
}

Zenzii
06-25-2005, 11:39 AM
What is the error message you are getting?????/

amazing_andr3
06-25-2005, 11:55 AM
I'm not getting any error. At least not on the Java console.

But there should be an error when I try to access the clipboard, because the copy method is not working. That's the exception that I'm trying to react to (with the alert).

Zenzii
06-25-2005, 12:55 PM
catch (SecurityException se) {// can't access clipboard
Frame frame = new Frame();
JOptionPane.showMessageDialog(frame, "The applet does not have access to the clipboard. You have to press CTRL + C to copy it.");
}
'

Instead of SecurityException try "Exception" and see what you get.

davey
06-25-2005, 04:30 PM
nevermind