title: Dragging node from JTree and dropping onto JLabel to perform an action
body: <p>I want to implement DnD on my system by dragging a node from a JTree and dropping it onto a JLabel.</p>
  
  <p>The JLabel is an Icon with certain properties about a machine, and by dragging the information from the JTree node onto the JLabel I want it to be able to send a message to a client listening on that machine.</p>
  
  <p>Any help is much appreciated!</p>
  
  <p>Example of label method:</p>
  
  <pre><code>private void makeLabel(String html, final String version) {
      // Create a button to link to the DR environment
      //JButton button = new JButton(html);
      JLabel machineLabel = new JLabel();
      machineLabel.setTransferHandler(new TransferHandler("text"));
      MouseListener listener = new DragMouseAdapter();
      machineLabel.addMouseListener(listener);
      machineLabel.setIcon(onlineIcon);
      machineLabel.setToolTipText("IP: " + html);
      //Add the button to the panel and make sure it appears
      machineLabel.setSize(25, 10);
      vecIcons.addElement(machineLabel);
      buttonPanel.add(machineLabel);
      buttonPanel.setVisible(true);
      buttonPanel.validate();
      dynaScrollPane.validate();
      buttonPanel.repaint();
      dynaScrollPane.repaint();
    }
  </code></pre>
  
  <p>DragMouseAdapter method:</p>
  
  <pre><code>    private class DragMouseAdapter extends MouseAdapter {
  public void mousePressed(MouseEvent e) {
    JComponent c = (JComponent) e.getSource();
    TransferHandler handler = c.getTransferHandler();
    handler.exportAsDrag(c, e, TransferHandler.LINK);
    }
  }
  </code></pre>
  
  <p>Then in order to make my tree draggable I just have: </p>
  
  <pre><code>exampleTree.setDragEnabled(true);
  </code></pre>