title: Drag and drop from JList / JTable with Object
body: <p>I have some problems with Drag and Drop with Java.</p>
  
  <p>It's pretty simple I think, I just want to allow a Drag drag and drop custom object from a JList to another.</p>
  
  <p>I've read lot of resources about that and now I have this code :</p>
  
  <pre><code>listPlantation = new JList();
  plantationList = Plantation.plantations;
  DefaultListModel dlm = new DefaultListModel();
  Iterator&lt;Plantation&gt; it = plantationList.iterator(); 
  // Here I instance my ListModel with my custom Element
  while(it.hasNext())
  {
      Plantation obj = it.next();
      if(obj !=null)
      {
          dlm.addElement(obj);
      }
  }
  // Yeah of course I want Drag Enable :) 
  listPlantation.setDragEnabled(true);
  // Ok let's create my Transferhandler
  listPlantation.setTransferHandler(new TransferHandler() {
  
      @Override
      protected Transferable createTransferable(JComponent c) {
  
          JList list =  (JList) c;
          Object vin  = list.getSelectedValue();
          if(vin instanceof VinAbstract)
          {
              System.out.println(vin);
              // I  created my Own transferable object for my custom object 
              return new TransferableVinAbstract((VinAbstract) vin);
          }
          return null;
      }
  
      @Override
      public int getSourceActions(JComponent c) {
          return COPY; // COPY MOVE COPY_OR_MOVE same problem :)
      }
  });
  listPlantation.setModel(dlm);
  </code></pre>
  
  <p>If I comment the SetTransferHandler part, it's working , but I only have the String representation of my object.</p>
  
  <p>And when SetTransferHandler part is "On", when I drag my object, in createTransferable >> System.out.println(vin) print me somethings good.</p>
  
  <p>The weirdest things is that I use more or less the same code for a JTree and it's working, but it's also doesn't work with JTable....</p>
  
  <p>Thanks for your reflexion anyway !</p>