PLEASE HELP (or my boss will kick me) Drag and drop
My Drag and drop works perfectly in appletviewer, but there seems to be a problem when used in a browser (i used I5 with WIN2000).
Does DnD in applet works on Win2000, Win98 ?
Does DnD in applet works on IE5 ? Netscape 4.7 ? Netscape 6 ?
Is there a DnD bug ?
If it doesn't work, can someone give me the reason why.
Please help
[371 byte] By [
folkenf] at [2007-9-26 1:18:21]

Hi,
What version of the JRE are you using? (I assume your using the plugin and not the default VM?)
From memory there has been at least one issue that has now been fixed related to IE5 - so I would suggest using the latest VM.
Have you tried 1.4 beta?
If you can post any errors/code etc. it would help.
Regards,
Matt.
Java Developer Technical Support
Sun Microsystems
math at 2007-6-29 0:49:16 >

There is a bug with dnd in an applet in that sometimes the dnd doesnt get initialised correctly when the applet starts. To fix this you need to initialise your dnd in a seperate thread after a small delay ie.
public void initDnD(){
javax.swing.SwingUtilities.invokeLater(new DnDThread(component));
}
this is called in my applets init() method and passes in the component (implements drop target listener) that is to be the drop target as a parameter to the constructor of the DnDThread class;
protected class DnDThread implements Runnable {
JComponent c;
public DnDThread(JComponent c) {
this.c = c;
}
public void run() {
// Give the parent thread a chance to finish
try {
Thread.sleep(2000);
} catch (InterruptedException ex) {}
if (c != null){
c.setDropTarget(new DropTarget(c, DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_LINK,
(DropTargetListener)c));
}
}
}
so basically all it is doing is setting up the dnd 2 seconds after the applet initialises.do this for all your drop targets and drag sources