• Post Reply Bookmark Topic Watch Topic
  • New Topic

Transfer drop to sub-component (need help with)  RSS feed

Diego Mendez Padilla
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all, hello

My problem is this:

I've been messing with Swing and Drag and Drop functionalities for an application and learned a lot in a few weeks. I've managed to create color tiles that work with drag and drop; dragging the color from the color tile and dropping in another component that get's drawn with the chosen color. I wanted to display the components (lets call them drawings) in a list, and said list should support drag and drop. I've managed to drag the drawings from one list to another, and to add or remove more drawings with drag and drop.

But when I try to drag a color to a drawing inside a list, it doesn't work, the list is catching the drag instead of the drawing. Is there a way to transfer the drag to the drawing?

Note that some drawings use gradients, thus there is need to know where, in the drawing, the color was dropped. Also, the drag and drop of the drawings works just fine if they are outside the list.

I'm using a custom TransferHandler for the list (as well as a custom ListModel and a custom ListCellRenderer)
The color tiles and the drawings implement DragGestureListener, Transferable and DropTargetListener.
My code at this point involves a lot of classes so it is hard to show.

Thanks to everyone who take the time to read my problem, hope you can help me.
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!