Results 1 to 10 of 10
- 05-19-2010, 11:08 AM #1
Member
- Join Date
- May 2010
- Posts
- 5
- Rep Power
- 0
DnD within applet no longer working on Java 6 update 20
Hi All. I am new here.
My Drag and Drop is no longer working after Java 6 update 10 to update 20.
The applet I worote shows
Exception in thread "AWT-EventQueue-2" java.security.AccessControlException: access denied (java.awt.AWTPermission accessClipboard)
I know about applet limitations but why id worked fine with Java 6 update 10?
The same when I lounch Java sun demo application from Demo - BasicDnD (The Java™ Tutorials > Creating a GUI With JFC/Swing > Drag and Drop and Data Transfer)
I don't want to sign applet and I cannot ask every user on the interent to modify "trust" files or whatever.
Can someone please show me how to DnD within same applet (for example JTree to JText area.
The problamatic code is
public void drop(DropTargetDropEvent dtde) {
try {
Transferable t = dtde.getTransferable();
if (dtde.isDataFlavorSupported(DataFlavor.stringFlavo r)) {
dtde.acceptDrop(dtde.getDropAction());
writeStringToTextAreaMethod(t.getTransferData(Data Flavor.stringFlavor).toString());
dtde.dropComplete(true);
} else dtde.rejectDrop();
} catch (IOException ioe) {
} catch (UnsupportedFlavorException usf) {
} catch(AccessControlException pe){}
}
- 05-19-2010, 04:23 PM #2
Sounds like Sun has changed something again.
I have a simiilar problem with some Applets I was using on my computer that read files locally. I had used the .java.policy file to give the applets permission. About version 6u4(??) the applets got Permission exceptions in some browsers: FF and IE. Never did figure it out. I backed up/changed the javaplugin for an older browser to version 5 and am able to use my applets with that browser.
Just noticedIt would seem that for security reasons an applet should NOT be able to read a user's clipboard.java.awt.AWTPermission accessClipboardLast edited by Norm; 05-19-2010 at 10:23 PM. Reason: Add msg re clipboard
- 05-20-2010, 12:58 AM #3
Senior Member
- Join Date
- Dec 2008
- Posts
- 526
- Rep Power
- 0
emm...
I think there can be some reasons
1) it is not JRE but its cert store has been rewritten :) You just add missing certs to your Java control Security -> Certificates.
2) Or maybe your app cert validity is simply up to date. Please watch its "Details" as from...to... and tell us the result
3) Or maybe the applet was modified and its signature is no more active :(
Please check out those three steps and tell us the resultIf my answer helped you. Please click my "REP" button and add a comment
Have a Good Java Coding :)
- 05-20-2010, 07:04 AM #4
Member
- Join Date
- May 2010
- Posts
- 5
- Rep Power
- 0
Thanks for your replies
My applet is not signed (never was) and the DnD solution worked fine until java6u10.
If you have java6u20 then please look at Java Sun DnD examples. Drag and Drop and Data Transfer: Examples (The Java™ Tutorials > Creating a GUI with JFC/Swing > Drag and Drop and Data Transfer)
These examples are not working (when you click Lounch) either on Java 6u20.
I believe that Sun messed up something ;)
I found a work around on this since I am "Draging and Dropping" within same applet. On the target drop Pannel, i am simply checking what is selected on the source list. So this is not atempting to read or write the clipboard.
public void drop(DropTargetDropEvent dtde) {
//tree.getLastSelectedPathComponent()
}
- 05-20-2010, 04:16 PM #5
I just went to the site, clicked on Launch, checked "Use DnD" in lower left of panel and had the DnD work in the text fields and text areas on the rightThese examples are not working
- 05-20-2010, 05:09 PM #6
Member
- Join Date
- May 2010
- Posts
- 5
- Rep Power
- 0
Hi Norm
You have probably Java version 6 update 10 or older. It is not working with at java 6 u 20 for example.
I have connsole open and I can see exception when I run the DnD examples.
- 05-20-2010, 06:46 PM #7
Here's my Java console when I Launch:
Here's the open permissions from my .java.policy file. Everything else has a codebaseJava Web Start 1.6.0_20
Using JRE version 1.6.0_20-b02 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\Owner
----------------------------------------------------
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
m: print memory usage
o: trigger logging
p: reload proxy configuration
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump thread list
v: dump thread stack
0-5: set trace level to <n>
----------------------------------------------------
grant {
permission java.lang.RuntimePermission "modifyThread";
permission java.lang.RuntimePermission "loadLibrary.HelloNative";
permission java.util.PropertyPermission "*", "read";
permission java.lang.RuntimePermission "modifyThreadGroup";
};Last edited by Norm; 05-20-2010 at 06:48 PM.
- 05-20-2010, 09:00 PM #8
Senior Member
- Join Date
- Dec 2008
- Posts
- 526
- Rep Power
- 0
Sorry but this exception as
says that your applet should be signed to access local clipboardjava.security.AccessControlException: access denied (java.awt.AWTPermission accessClipboard)
I repeat either its signature is corrupted or you should resign it etc
Actually there are two clipboard types... OS clipboard and proc clipboard ... The OS cb returns list of files java.io.File so any applet which contains that kind of clipboard should be signed... It is all depends the objects you want to paste :) The problem may occure if you trying to paste a local file from OS folder etc
I think it is your case ;)Last edited by Webuser; 05-20-2010 at 09:04 PM.
If my answer helped you. Please click my "REP" button and add a comment
Have a Good Java Coding :)
- 05-20-2010, 09:11 PM #9
Senior Member
- Join Date
- Dec 2008
- Posts
- 526
- Rep Power
- 0
emm...
concerning the JRE update
perhaps the JRE update could change the number of DnD libs and their relations so to make your applet work don't make it use JRE libs but just add all required libs right to your applet jar and sign it... So make your applet call the required libs not from JRE but from its jar... You know I mean?If my answer helped you. Please click my "REP" button and add a comment
Have a Good Java Coding :)
- 05-21-2010, 10:46 AM #10
Member
- Join Date
- May 2010
- Posts
- 5
- Rep Power
- 0
Thanks to all for your replies.
I use to have JDK 6 isntalled on my PC (don' remember update version) and then instlled JRE 6. Maybe the problem is seen only on my two testing PCs where both of them had JDK installed.
Lounching Sun's BasicDnD shows exceptions on the console and a dialog showing "null" dropped between demo components.
There are customers that complained about our "apache ssl" certicicate. Signing applet will result in another extra warning message "This signiture is not verified" to the customer.
So I found a solution as I have described on my previous post.
Similar Threads
-
Update statement not working.
By OMFGITSROHIT in forum JDBCReplies: 5Last Post: 04-08-2010, 01:03 PM -
Why does refresh not update applet?
By Krooger in forum Java AppletsReplies: 1Last Post: 12-26-2009, 09:00 PM -
Applet not working
By jyothi.priyanka in forum New To JavaReplies: 5Last Post: 04-16-2009, 08:18 AM -
Scrolling Applet Pictures Disappeared After Update.
By MrPitBull in forum New To JavaReplies: 10Last Post: 04-05-2009, 12:21 AM -
ant no longer working
By varun077 in forum EclipseReplies: 1Last Post: 07-25-2008, 09:57 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks