title: Java Multiple Drag and Drop Panels does not work
body: <p>I have multiple DnD panels layered on a Jpanel with boarder layout..Each DnD panel has a Text field set as a drop target. Only last DnD panel gets the focus. Others do not act as drop targets. Here is the code for DnD panel</p>
  
  <pre><code>public class DnDPanel extends javax.swing.JPanel {
  /** Creates new form DnDPanel */
  
  public DnDPanel() {
      initComponents();        
      dndTextField.setDropTarget(new DropTarget() {
  
          @Override
          public synchronized void drop(DropTargetDropEvent evt) {
              try {
                  dndTextField.setBackground(Color.WHITE);
                  evt.acceptDrop(DnDConstants.ACTION_COPY);
                  List&lt;File&gt; droppedFiles = (List&lt;File&gt;) evt.getTransferable().getTransferData(
                          DataFlavor.javaFileListFlavor);
                  for (File file : droppedFiles) {
                      dndTextField.setText(file.getAbsolutePath());
                  }
                  dndTextField.setBackground(Color.getHSBColor(0.56f, 1.0f, 0.9f));
              } catch (Exception ex) {
                  ex.printStackTrace();
              }
          }
  
          @Override
          public synchronized void dragEnter(DropTargetDragEvent dtde) {
              //Change cursor...
              Cursor cursor = new Cursor(Cursor.HAND_CURSOR);
              setCursor(cursor);
              dndTextField.setText("Drop Here !!");
              dndTextField.setBackground(Color.getHSBColor(0.56f, 1.0f, 0.9f));
          }
  
          @Override
          public synchronized void dragExit(DropTargetEvent dtde) {
              Cursor cursor = new Cursor(Cursor.DEFAULT_CURSOR);
              setCursor(cursor);
              dndTextField.setBackground(Color.WHITE);
              dndTextField.setText("Drag n drop a Folder");
          }
      });
  }
  
  public static void setText(String text)
  {
      dndTextField.setText(text);
  }
  
  public static String getPath()
  {
      return dndTextField.getText();
  }
  
  
  /** This method is called from within the constructor to
   * initialize the form.
   * WARNING: Do NOT modify this code. The content of this method is
   * always regenerated by the Form Editor.
   */
  @SuppressWarnings("unchecked")
  // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt;
  private void initComponents() {
  
      dndTextField = new javax.swing.JTextField();
  
      setPreferredSize(new java.awt.Dimension(250, 250));
  
      dndTextField.setHorizontalAlignment(javax.swing.JTextField.CENTER);
      dndTextField.setText("DnD");
      dndTextField.addActionListener(new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
              dndTextFieldActionPerformed(evt);
          }
      });
  
      org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
      this.setLayout(layout);
      layout.setHorizontalGroup(
          layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
          .add(layout.createSequentialGroup()
              .add(dndTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 244, Short.MAX_VALUE)
              .addContainerGap())
      );
      layout.setVerticalGroup(
          layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
          .add(layout.createSequentialGroup()
              .add(dndTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 244, Short.MAX_VALUE)
              .addContainerGap())
      );
  }// &lt;/editor-fold&gt;
  
  private void dndTextFieldActionPerformed(java.awt.event.ActionEvent evt) {                                             
      // TODO add your handling code here:
  }                                            
  
  // Variables declaration - do not modify
  private static javax.swing.JTextField dndTextField;
  // End of variables declaration
  }
  </code></pre>