title: Drag and drop feedback in a JTree with custom TreeCellRenderer (Java, Swing)
body: <p>I have a class derived from JTree with custom TreeCellRenderers. I have implemented drag and drop in that tree, so a user can rearrange tree nodes.</p>
  
  <p>The drop mode is <code>DropMode.ON_OR_INSERT</code>, so the user can drop nodes on or between other nodes. While the user is dragging the node, if the pointer points between nodes, a blue line is drawn indicating a location where the node will be inserted. If the pointer is on a node, there is no indication of where the node will be added. This only happens when I use my custom TreeCellRenderer. If I use a DefaultTreeCellRenderer, the drop node gets highlighted during the drag.</p>
  
  <p>I found a few examples on the web, where people store the node that is currently highlighted in the JTree and query it from the TreeCellRenderer, rendering the node in different color if TreeCellRenderer is called for the node that is supposed to be highlighted.</p>
  
  <p>Is there a more elegant solution for highlighting the drop node? I haven't managed to figure out how DefaultTreeRenderer does this - there seem to be no hooks in it to drag and drop functionality. </p>