Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

djangohead

macrumors newbie
Original poster
Jan 5, 2010
1
0
Manchester
I am trying to create an uploader applet using JFileChooser for file selection. I want the user to be able to drag files from JFileChooser into another component.

I have this code working in Windows but the drag event is simply not registering on the Mac. Left click and drag down simply selects all the the directories/files within the current directory. Is this a bug related to Apple's implementation of Java, or Apple's custom implementation of JFileChooser? I can get drag/drop events to work using any other component, just not JFileChooser.

Any help on this issue is a massive help as I cannot find anything related to the problem I'm having after searching on the net.

System:

Mac OS X Snow Leapord Version 10.6.2

java version "1.6.0_17"
Java(TM) SE Runtime Environment (build 1.6.0_17-b04-248-10M3025)
Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01-101, mixed mode)

Thank you
 
I am trying to create an uploader applet using JFileChooser for file selection. I want the user to be able to drag files from JFileChooser into another component.

That doesn't sound like a Mac gesture. I just tried it using the native dialogs in TextEdit and several other apps, and no combination of clicks and modifier keys was able to start a drag.

It seems that the inability to drag files out of a file-chooser isn't just Java. You may have to rethink your strategy.

EDIT: I take it back. It can do a drag out in native dialogs. It only starts a drag when the click is on an unselected item, and if movement starts within a brief interval.

Still no-go in Java file-chooser though. Try an AWT FileDialog instead, or rethink your strategy.
 
If you happen to need file type filters (which don't work in FileDialogs), AND need a native look and feel, give the Quaqua library a try. I use it for my Java development.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.