This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

DND out of an application?

 
Author
Posts: 131
7
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For the most part I've figured out DND with trees and other thing within a GUI but now I'd like to DND out of the application and say. Say I have a JTree representing directories on the file system. I'd like to be able to drag from my GUI onto the desktop and have windows copy the file to the desktop. Any ideas? Everytime I try it I get the "no drop" icon when I hover over the desktop.
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As shown in $1.5docs/guide/dragndrop/spec/dnd1.html#2.5.3 this

works okay (single files only) for copy_and_paste and for drag_n_drop from a JTree to the win xp desktop.
To test it I used a (plain) JTree with FileStore class nodes, a TransferHandler for the tree and a Transferable class like the one in TreeDrag from this thread DND from JTree to JTable. And copied the createMenuBar method from the DragPictureDemo2 app in the Adding Cut/Copy/Paste Support section of the DnD tutorial.
 
Why does your bag say "bombs"? The reason I ask is that my bag says "tiny ads" and it has stuff like this:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!