import java.awt.datatransfer.Transferable; static void listEnableDrag(final JList list, TransferHandler th) { if (list.getDragEnabled()) { print("List drag already enabled"); ret; } list.setDragEnabled(true); list.setTransferHandler(th); list.addMouseListener(new MouseAdapter { @Override public void mousePressed(MouseEvent e) { if (e.getButton() == 1 && e.getClickCount() == 1) list.getTransferHandler().exportAsDrag(list, e, TransferHandler.COPY); } }); }