private MyFile[] getSelectedFiles() {
   int[] selectedRows = table.getSelectedRows();
   MyFile[] filesTemp = new MyFile[selectedRows.length];
   FileTableModel model = (FileTableModel) table.getModel();
   int count = 0;
   for (int i : selectedRows) {
     i = table.getRowSorter().convertRowIndexToModel(i);
     filesTemp[count] = model.getFile(i);
     count++;
   }
   return filesTemp;
 }
  public void dragGestureRecognized(DragGestureEvent evt) {
    if (files == null) return;
    if (files.length <= 0) {
      return;
    }
    Icon icn = files[0].getIcon(false);
    Toolkit tk = Toolkit.getDefaultToolkit();
    if (icn == null) icn = new EmptyIcon();
    Dimension dim = tk.getBestCursorSize(icn.getIconWidth(), icn.getIconHeight());

    // set up drag image
    if (DragSource.isDragImageSupported()) {
      BufferedImage buff =
          new BufferedImage(dim.width + 100, dim.height, BufferedImage.TYPE_INT_ARGB);
      Graphics graphics = buff.getGraphics();
      Color color = graphics.getColor();
      icn.paintIcon(null, graphics, 0, 0);
      graphics.setColor(color);
      graphics.setColor(Color.RED);
      graphics.drawString(files.length + " Elements", icn.getIconWidth(), dim.height / 2);
      try {
        evt.startDrag(
            DragSource.DefaultCopyDrop,
            buff,
            new Point(0, 0),
            new FileTransferable(files, table.getTableModel()),
            this);
      } catch (IOException ex) {
        Logger.getLogger(FileDragGestureListener.class.getName()).log(Level.SEVERE, null, ex);
      }
    } else {
      BufferedImage buff = new BufferedImage(dim.width, dim.height, BufferedImage.TYPE_INT_ARGB);
      Graphics graphics = buff.getGraphics();
      icn.paintIcon(null, graphics, 0, 0);
      try {
        cursor = tk.createCustomCursor(buff, new Point(0, 0), "tempcursor");
        evt.startDrag(
            cursor,
            null,
            new Point(0, 0),
            new FileTransferable(files, table.getTableModel()),
            this);
      } catch (IOException ex) {
        Logger.getLogger(FileDragGestureListener.class.getName()).log(Level.SEVERE, null, ex);
      }
    }
  }
 public FileDragGestureListener(FileTable table) {
   this.table = table;
   table.getSelectionModel().addListSelectionListener(this);
 }
 public void updateModel(MyFile file, int modelAction) {
   FileTableModel model = (FileTableModel) table.getModel();
   modelWFile = model.getParent().getFile();
   FileTransferDialog.updateModelSt(file, modelAction, model, modelWFile);
 }