final DragGesture dragGesture = new DragGesture();
DragSource dragSource = DragSource.getDefaultDragSource();
dragSource.createDefaultDragGestureRecognizer(c, DnDConstants.ACTION_MOVE, dragGesture);
dragSource.addDragSourceMotionListener(dragGesture);
panel.addContainerListener(new ContainerListener() {
public void componentAdded(ContainerEvent e) {
if (e.getChild() instanceof ToolWindowTabPanel) {
ToolWindowTabPanel panel = (ToolWindowTabPanel) e.getChild();
for (Component cmp : panel.getTabContainer().getComponents()) {
DragSource dragSource = DragSource.getDefaultDragSource();
dragSource.createDefaultDragGestureRecognizer(cmp, DnDConstants.ACTION_MOVE, dragGesture);
dragSource.addDragSourceMotionListener(dragGesture);
}
panel.getTabContainer().addContainerListener(new ContainerListener() {
public void componentAdded(ContainerEvent e) {
DragSource dragSource = DragSource.getDefaultDragSource();
dragSource.createDefaultDragGestureRecognizer(e.getChild(), DnDConstants.ACTION_MOVE, dragGesture);
dragSource.addDragSourceMotionListener(dragGesture);
}