I have a Java Swt application which accepts files dragged and dropped from the outside (eg. Windows Explorer).
However, when running the installed version, created with Advanced Installer 12.2.1, the drop onto the app window is disabled.
A black crossed circle icon is displayed when dragging a file over app window, as opposed to the expected drop target cursor with a plus symbol and a dashed rectangle.
When I manually created a cmd file in the installed directory, which runs java with the bundled JRE, classpath etc., drop is working fine.
So it appears like an issue with the EXE starter generated by Advanced Installer.
Please let me know how to enable drag'n'drop of files.
Thanks!
Sample code which reproduces the issue:
Code: Select all
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.DropTarget;
import org.eclipse.swt.dnd.DropTargetEvent;
import org.eclipse.swt.dnd.DropTargetListener;
import org.eclipse.swt.dnd.FileTransfer;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class FileDrop {
public static void main(String[] args) {
Display display = Display.getDefault();
Shell sh = new Shell(display);
DropTarget droptarget = new DropTarget(sh, DND.DROP_MOVE
| DND.DROP_COPY | DND.DROP_DEFAULT | DND.DROP_LINK);
final FileTransfer fileTransfer = FileTransfer.getInstance();
final TextTransfer textTransfer = TextTransfer.getInstance();
droptarget.setTransfer(new Transfer[] { textTransfer, fileTransfer });
droptarget.addDropListener(new DropTargetListener() {
public void dragEnter(DropTargetEvent e) {
e.detail = DND.DROP_COPY;
}
public void dragOver(DropTargetEvent e) {
}
public void dragOperationChanged(DropTargetEvent e) {
}
public void dragLeave(DropTargetEvent event) {
}
public void dropAccept(DropTargetEvent event) {
}
public void drop(DropTargetEvent e) {
}
});
sh.open();
while (!sh.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
FOLLOW US
Get the latest news in Application Packaging