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

Java DND (Move Component with properties)?  RSS feed

 
Chaz Branham
Ranch Hand
Posts: 53
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All,

I have been working with Drag and Drop in Java for a little while now but I'm confused and dont know how to transfer my object along with it's properties properly using the Java DND library.

What I am atempting to do is drag one JPanel into another JPanel with all of it's properties. I have it dragging correctly no error's and I have a message box popup when the drop action happens but when the following code is called during the DND (if I have it open in debug mode) I start seeing things like DropTarget not available.



Can anyone please explain how I can properly transfer an exactly replicata of an object and it's properties using the DND library?

Here is the object I want to move from one JPanel to the Next:


Here is the JPanel I am trying to drag it to and should add the object to the layout:



If I am not being clear or if you have any questions to help me resolve this issue I would be glad to try and answer them. Any help is greatly appreciated!

Thanks
 
Chaz Branham
Ranch Hand
Posts: 53
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok so I believe I started making some headway with this a bit. Using a DataFlavor and using .importData on the transferhandler seems to only transmit data and not the actual object. I was able to make a simple example project that seems to support those assumptions but I still don't know how to pass the current object to the transferhandler. Back to researching... If anyone has anything to add I would appreciate any guidance.

Have a good one.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!