Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Drag from a JList to the desktop  RSS feed

 
Raf Szczypiorski
Ranch Hand
Posts: 383
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. I am trying to implement a DnD action in which the user selects an item on a JList, drags it to the desktop, and drops - this would create a file with some contents. I couldn't find anything on how to go about it. Could you give me some hints?
I managed to implement DnD to the list from the desktop, DnD within the list (reordering), but I have no idea how to go about dropping on the desktop. I don't know how to discover that the drop occured "outside" JVM. When I start dragging, after creating a transferable and calling DragGestureEvent with my own DragSourceListener I can discover drag events, like dragEntered or dragExited. However, DragSourceListener.dragDropEnd is called after the drop target processed it (I can see that when I reorder the list items), and this is to late to create the files probably.
Can anyone help?
 
Doua Beri
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi. I'm not sure if what you want can be done. Your problems seems to be an OS problem and java want to keep their independency. I had a similar problem as yours and I come to the conclusion that it can't be done or it's very hard to do this using pure java code. But like I sad I'm not 100% sure.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!