• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Transfer drop to sub-component (need help with)

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic