Drag and Drop in Windows error

M

Matthew Zimmer

Hi all,
I'm working on a program and have run into a bit of a snag with drag and
drop. I have a java object that keeps a list of files in various views
(similar to a windows exlorer window). Now, I've got it working to the
point that I can drag files and directories from windows into my java
program and have everything work just fine. I've also got it working
such that I can drag a single file from my program into windows.

However, when I try to drag a directory from the java program into
windows I get a weird reaction. Basically, whatever I'm trying to drag
into locks up. For example, say I have my program open and I drag a
directory from the program into a windows explorer window. To do this,
I create temporary files of everything in the directory (and the
directory itself) and put them into the list that gets returned from the
getTransferData method. Since the explorer window is locked up, I have
to shut it down and can't see what happened. However, when I go back to
the place where I did the drop, the files are there. Unfortunately, I
can't ignore the lockup since if you drop to the desktop the entire
computer locks up and I have to reboot.

I'm really confused as to why this is happening. I'm using WindowsXP
and java 1.4.1_01. Does anybody have any ideas on what I'm doing wrong
here? Thanks for any help.

Matthew Zimmer
 
M

Matthew Zimmer

Matthew said:
Hi all,
I'm working on a program and have run into a bit of a snag with drag and
drop. I have a java object that keeps a list of files in various views
(similar to a windows exlorer window). Now, I've got it working to the
point that I can drag files and directories from windows into my java
program and have everything work just fine. I've also got it working
such that I can drag a single file from my program into windows.

However, when I try to drag a directory from the java program into
windows I get a weird reaction. Basically, whatever I'm trying to drag
into locks up. For example, say I have my program open and I drag a
directory from the program into a windows explorer window. To do this,
I create temporary files of everything in the directory (and the
directory itself) and put them into the list that gets returned from the
getTransferData method. Since the explorer window is locked up, I have
to shut it down and can't see what happened. However, when I go back to
the place where I did the drop, the files are there. Unfortunately, I
can't ignore the lockup since if you drop to the desktop the entire
computer locks up and I have to reboot.

I'm really confused as to why this is happening. I'm using WindowsXP
and java 1.4.1_01. Does anybody have any ideas on what I'm doing wrong
here? Thanks for any help.

Matthew Zimmer

Sorry...the method where I put the files in the list when dragging from
my program is dragGestureRecognized, not getTransferData.
 
M

Matthew Zimmer

Matthew said:
Hi all,
I'm working on a program and have run into a bit of a snag with drag and
drop. I have a java object that keeps a list of files in various views
(similar to a windows exlorer window). Now, I've got it working to the
point that I can drag files and directories from windows into my java
program and have everything work just fine. I've also got it working
such that I can drag a single file from my program into windows.

However, when I try to drag a directory from the java program into
windows I get a weird reaction. Basically, whatever I'm trying to drag
into locks up. For example, say I have my program open and I drag a
directory from the program into a windows explorer window. To do this,
I create temporary files of everything in the directory (and the
directory itself) and put them into the list that gets returned from the
getTransferData method. Since the explorer window is locked up, I have
to shut it down and can't see what happened. However, when I go back to
the place where I did the drop, the files are there. Unfortunately, I
can't ignore the lockup since if you drop to the desktop the entire
computer locks up and I have to reboot.

I'm really confused as to why this is happening. I'm using WindowsXP
and java 1.4.1_01. Does anybody have any ideas on what I'm doing wrong
here? Thanks for any help.

Matthew Zimmer

Okay, I finally figured out the answer and figured I'd share it here in
case anybody else ever runs across a similar problem. The problem with
directories was that I was putting not only the directory in the list of
drag files, but also every file in the directory. My supposition is
that Windows moved the directory correctly, but then hung while waiting
for the other files to actually show up for it to move. Simply putting
in the topmost directory into the list made everything work out fine.

Matthew
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top