posted 10 years ago
One way you could do this is with a glass pane set over your JRootPane on you top–level container. When you start dragging the shape from the origin panel you could set the glass pane visible and draw/drag the shape on the glass pane (possibly removing it from the origin component). When you drop the shape over the destination component (mouseReleased) you can set the glass pane invisible and draw the shape on the destination component. You could remove the shape from the origin component after the drop onto destination or at the initial drag. You would need MouseInputAdapters for both the origin component and glass pane component. The Swing tutorial has a glass pane demonstration example with useful suggestions found on How to Use Root Panes.