Kc Wong

Greenhorn
+ Follow
since May 13, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Kc Wong

David Morgan wrote:So, I know this is really really old, but I'm seeing the same problem.

I'm running a signed applet, and only the frames launched from JavaScript show the warning banner (icon now in 1.6)

Anyone have any info on this? I haven't been able to find out much about it.



Hmm... I know this is really really really really old, but I have a workaround now. Ugly, yes, but it got rid of the icon.

Same scenario with the above two posters: signed applet that creates a new dialog/frame when invoked by JavaScript.

I created a JDialog first, then called its setVisible() in these locations and FAILED:

1. AccessController.doPrivileged() - checkPermission(new AWTPermission("showWindowWithoutWarningBanner")) didn't even throw exception. Yet I got the icon.

2. AccessControlContext - I saved the instance from applet with AccessController.getContext(), and use it during doPrivileged(). checkPermission still okay and still got icon.

3. SwingUtilities.invokeLater() - Thinking the information may be carried by the current thread, I tried using another thread. Icon again.

4. Background thread - I created a background thread, and the function invoked by JavaScript sent a signal. Still had icon.


At this point I thought it had something to do with when the JDialog was constructed. So for 3. and 4. I moved the JDialog construction code inside - and the background thread method worked. Looks like SwingUtilities carried over the "insecure context" information as well.

So in summary:
1. Create a background thread in applet.
2. JavaScript invokes a method in applet that sends a signal to background thread.
3. Background thread receives the signal, creates the dialog and displays it.
4. Background thread passes the created dialog back to caller, so you can access the created dialog's methods and properties.
12 years ago