Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Problem with Drag and drop
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem with Drag and drop




Hi List,

Have a look at this implementation of the dragEnter() method of the DropTargetListener interface:

1        public void dragEnter(DropTargetDragEvent dtde){
2                dtde.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE);
3                Transferable tr = dtde.getTransferable();
4                List l = (List) tr.getTransferData(DataFlavor.javaFileListFlavor);
5                File f = (File) l.get(0);
6        }

When the user drag a file over the JFrame I get the following error :
2007-05-15 11:26:11.062 java[7349] CDataTransferer_dragQueryFile: plist not a valid NSArray (error XML parser error:
        Unexpected character U at line 1
Old-style plist parser error:
        Unexpected ';' or '=' after key at line 1
).

It is obviously followed by a NullPointerException if I surround line 4 with a try/catch.
The same kind of code works great in the DropTargetListener.drop() method.
The Mac OS X usual way of dealing with drag and drop is to tell the user if the drop is going to be accepted even before the drop occurs, while user is still dragging (It is usually represented with a little '+' on the mouse cursor).
Now because of this problem, it is impossible.

Does someone have a workaround for this?
Should I create a bug?

Best,
Mike

PS: Also I had to hack quite a bit to get that '+' mouse cursor.
I currently use (Cursor)Toolkit.getDefaultToolkit().getDesktopProperty("DnD.Cursor.CopyDrop").
Do you know a better way of doing this?

******************************************
Michael TOULA
Software Engineer

Dalim Software GmbH
Strassburger Str. 6
D-77694
Kehl am Rhein
GERMANY

tel:   +49 7851 919 612
fax:  +49 7851 735 76
web:   www.dalim.com
**************************************************************
Dalim Software’s mission is the continued development of innovative solutions that greater facilitate the production workflow throughput of media communications companies.
Geschäftsführer (CEO): Dr. Carol Werlé    Vorsitzender des Aufsichtsrats (Chairman): Jim D. Salmon    
Ust-IdNr. (VAT-Nr.): DE 195 290 616    Sitz der Gesellschaft (Location): Kehl, Amtsgericht Freiburg, HRB 371620
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.