[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 839
  • Last Modified:

Enabling Drag n Drop on JTree

Hi,

How do I enable DnD of files into a JTree?

Basically I need to DnD files from an OS into a JTree in my swing app. The files will then displayed in the Jtree.

I do not require for DnD of nodes within the JTree, just files from OS to the JTree.

Thanks

DBB
0
DBB
Asked:
DBB
  • 4
  • 3
1 Solution
 
DBBAuthor Commented:
Thanks,

Any examples for this using JTree within Netbeans?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
DBBAuthor Commented:
I mean manipulating a netbeans generated JTree to accept files via DnD.  
0
 
CSecurityCommented:
You can't do too much manipulation in NetBeans, NetBeans locks a lot of modifiying and you have to use NetBeans IDE to do that. For this stuff, you have to do it in notepad or another editor.
0
 
DBBAuthor Commented:
Ok, So I have done the following:-

set a Transfer Handler on my custom JTree component

within the transfer handler, written custom transfer handler to handle file drop on the jtree.

Now I would like to change the system cursor whilst moused over the jtree and drag is active to give the user feedback that they can drop the file.

How is this achieved, I tried adding in the canImport method but this changes the cursor on mouseover even when no drag is active.

thanks

Dbb
0
 
DBBAuthor Commented:
Thanks!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now