List of usage examples for java.awt.datatransfer DataFlavor javaFileListFlavor
DataFlavor javaFileListFlavor
To view the source code for java.awt.datatransfer DataFlavor javaFileListFlavor.
Click Source Link
From source file:com.ftb2om2.view.MultiplePane.java
private void difficultyTableDragAndDrop(DropTargetDropEvent evt) { try {//from w ww .j a va2 s. c o m DefaultTableModel model = (DefaultTableModel) difficultyTable.getModel(); evt.acceptDrop(DnDConstants.ACTION_COPY); List<File> droppedFile = (List<File>) evt.getTransferable() .getTransferData(DataFlavor.javaFileListFlavor); droppedFile.forEach(file -> model.addRow( new Object[] { file.getName(), file.getPath(), FilenameUtils.getBaseName(file.getPath()) })); } catch (Exception ex) { Logger.getLogger(MainWindow.class.getName()).log(Level.INFO, null, ex); } }
From source file:xtrememp.PlaylistManager.java
@Override @SuppressWarnings("unchecked") public void drop(DropTargetDropEvent ev) { DropTargetContext targetContext = ev.getDropTargetContext(); Transferable t = ev.getTransferable(); try {// w ww .jav a 2s. c om // Windows if (t.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) { ev.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE); addFiles((List<File>) t.getTransferData(DataFlavor.javaFileListFlavor), false); targetContext.dropComplete(true); // Linux } else if (t.isDataFlavorSupported(DataFlavor.stringFlavor)) { ev.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE); String urls = (String) t.getTransferData(DataFlavor.stringFlavor); List<File> fileList = new ArrayList<>(); StringTokenizer st = new StringTokenizer(urls); while (st.hasMoreTokens()) { URI uri = new URI(st.nextToken()); fileList.add(new File(uri)); } addFiles(fileList, false); targetContext.dropComplete(true); } } catch (UnsupportedFlavorException | InvalidDnDOperationException | IOException | URISyntaxException ex) { logger.error(ex.getMessage(), ex); } }
From source file:gdt.jgui.entity.folder.JFolderPanel.java
/** * Get the context menu./*from w ww. java 2 s . c om*/ * @return the context menu. */ @Override public JMenu getContextMenu() { menu = super.getContextMenu(); mia = null; int cnt = menu.getItemCount(); if (cnt > 0) { mia = new JMenuItem[cnt]; for (int i = 0; i < cnt; i++) mia[i] = menu.getItem(i); } menu.addMenuListener(new MenuListener() { @Override public void menuSelected(MenuEvent e) { //System.out.println("EntitiesPanel:getConextMenu:menu selected"); menu.removeAll(); if (mia != null) { for (JMenuItem mi : mia) menu.add(mi); menu.addSeparator(); } JMenuItem refreshItem = new JMenuItem("Refresh"); refreshItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JConsoleHandler.execute(console, locator$); } }); menu.add(refreshItem); JMenuItem openItem = new JMenuItem("Open folder"); openItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { File folder = new File(entihome$ + "/" + entityKey$); if (!folder.exists()) folder.mkdir(); Desktop.getDesktop().open(folder); } catch (Exception ee) { LOGGER.severe(ee.toString()); } } }); menu.add(openItem); JMenuItem importItem = new JMenuItem("Import"); importItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { File home = new File(System.getProperty("user.home")); Desktop.getDesktop().open(home); } catch (Exception ee) { LOGGER.severe(ee.toString()); } } }); menu.add(importItem); JMenuItem newItem = new JMenuItem("New text"); newItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { JTextEditor textEditor = new JTextEditor(); String teLocator$ = textEditor.getLocator(); teLocator$ = Locator.append(teLocator$, Entigrator.ENTIHOME, entihome$); String text$ = "New" + Identity.key().substring(0, 4) + ".txt"; teLocator$ = Locator.append(teLocator$, JTextEditor.TEXT, text$); JFolderPanel fp = new JFolderPanel(); String fpLocator$ = fp.getLocator(); fpLocator$ = Locator.append(fpLocator$, Entigrator.ENTIHOME, entihome$); fpLocator$ = Locator.append(fpLocator$, EntityHandler.ENTITY_KEY, entityKey$); fpLocator$ = Locator.append(fpLocator$, BaseHandler.HANDLER_METHOD, "response"); fpLocator$ = Locator.append(fpLocator$, JRequester.REQUESTER_ACTION, ACTION_CREATE_FILE); String requesterResponseLocator$ = Locator.compressText(fpLocator$); teLocator$ = Locator.append(teLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR, requesterResponseLocator$); JConsoleHandler.execute(console, teLocator$); } catch (Exception ee) { LOGGER.severe(ee.toString()); } } }); menu.add(newItem); //menu.addSeparator(); if (hasToInsert()) { menu.addSeparator(); JMenuItem insertItem = new JMenuItem("Insert"); insertItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { Clipboard systemClipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); Transferable clipboardContents = systemClipboard.getContents(null); if (clipboardContents == null) return; Object transferData = clipboardContents .getTransferData(DataFlavor.javaFileListFlavor); List<File> files = (List<File>) transferData; for (int i = 0; i < files.size(); i++) { File file = (File) files.get(i); if (file.exists() && file.isFile()) { System.out.println("FolderPanel:insert:in=" + file.getPath()); File dir = new File(entihome$ + "/" + entityKey$); if (!dir.exists()) dir.mkdir(); File out = new File(entihome$ + "/" + entityKey$ + "/" + file.getName()); if (!out.exists()) out.createNewFile(); System.out.println("FolderPanel:insert:out=" + out.getPath()); FileExpert.copyFile(file, out); JConsoleHandler.execute(console, getLocator()); } // System.out.println("FolderPanel:import:file="+file.getPath()); } } catch (Exception ee) { LOGGER.severe(ee.toString()); } } }); menu.add(insertItem); } if (hasToPaste()) { menu.addSeparator(); JMenuItem pasteItem = new JMenuItem("Paste"); pasteItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String[] sa = console.clipboard.getContent(); Properties locator; String file$; File file; File target; String dir$ = entihome$ + "/" + entityKey$; File dir = new File(dir$); if (!dir.exists()) dir.mkdir(); for (String aSa : sa) { try { locator = Locator.toProperties(aSa); if (LOCATOR_TYPE_FILE.equals(locator.getProperty(Locator.LOCATOR_TYPE))) { file$ = locator.getProperty(FILE_PATH); file = new File(file$); target = new File(dir$ + "/" + file.getName()); if (!target.exists()) target.createNewFile(); FileExpert.copyFile(file, target); } } catch (Exception ee) { LOGGER.info(ee.toString()); } } JConsoleHandler.execute(console, locator$); } }); menu.add(pasteItem); } if (hasSelectedItems()) { menu.addSeparator(); JMenuItem deleteItem = new JMenuItem("Delete"); deleteItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int response = JOptionPane.showConfirmDialog(console.getContentPanel(), "Delete ?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (response == JOptionPane.YES_OPTION) { String[] sa = JFolderPanel.this.listSelectedItems(); if (sa == null) return; Properties locator; String file$; File file; for (String aSa : sa) { locator = Locator.toProperties(aSa); file$ = locator.getProperty(FILE_PATH); file = new File(file$); try { if (file.isDirectory()) FileExpert.clear(file$); file.delete(); } catch (Exception ee) { LOGGER.info(ee.toString()); } } } JConsoleHandler.execute(console, locator$); } }); menu.add(deleteItem); JMenuItem copyItem = new JMenuItem("Copy"); copyItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String[] sa = JFolderPanel.this.listSelectedItems(); console.clipboard.clear(); if (sa != null) for (String aSa : sa) console.clipboard.putString(aSa); } }); menu.add(copyItem); JMenuItem exportItem = new JMenuItem("Export"); exportItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { String[] sa = JFolderPanel.this.listSelectedItems(); Properties locator; String file$; File file; ArrayList<File> fileList = new ArrayList<File>(); for (String aSa : sa) { try { locator = Locator.toProperties(aSa); file$ = locator.getProperty(FILE_PATH); file = new File(file$); fileList.add(file); } catch (Exception ee) { LOGGER.severe(ee.toString()); } } File[] fa = fileList.toArray(new File[0]); if (fa.length < 1) return; // System.out.println("Folderpanel:finish:list="+fa.length); JFileChooser chooser = new JFileChooser(); chooser.setCurrentDirectory(new java.io.File(System.getProperty("user.home"))); chooser.setDialogTitle("Export files"); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); chooser.setAcceptAllFileFilterUsed(false); if (chooser.showSaveDialog(JFolderPanel.this) == JFileChooser.APPROVE_OPTION) { String dir$ = chooser.getSelectedFile().getPath(); File target; for (File f : fa) { target = new File(dir$ + "/" + f.getName()); if (!target.exists()) target.createNewFile(); FileExpert.copyFile(f, target); } } else { Logger.getLogger(JMainConsole.class.getName()).info(" no selection"); } // System.out.println("Folderpanel:finish:list="+fileList.size()); } catch (Exception eee) { LOGGER.severe(eee.toString()); } } }); menu.add(exportItem); } } @Override public void menuDeselected(MenuEvent e) { } @Override public void menuCanceled(MenuEvent e) { } }); return menu; }
From source file:org.apache.jmeter.gui.MainFrame.java
public boolean openJmxFilesFromDragAndDrop(Transferable tr) throws UnsupportedFlavorException, IOException { @SuppressWarnings("unchecked") List<File> files = (List<File>) tr.getTransferData(DataFlavor.javaFileListFlavor); if (files.isEmpty()) { return false; }/*w ww . j av a2 s . c om*/ File file = files.get(0); if (!file.getName().endsWith(".jmx")) { log.warn("Importing file:" + file.getName() + "from DnD failed because file extension does not end with .jmx"); return false; } ActionEvent fakeEvent = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, ActionNames.OPEN); LoadDraggedFile.loadProject(fakeEvent, file); return true; }
From source file:org.jets3t.apps.uploader.Uploader.java
/** * Initialise the application's File drop targets for drag and drop copying of local files * to S3./*from ww w . ja v a 2 s . c o m*/ * * @param dropTargetComponents * the components files can be dropped on to transfer them to S3 */ private void initDropTarget(Component[] dropTargetComponents) { DropTargetListener dropTargetListener = new DropTargetListener() { private Border originalBorder = appContentPanel.getBorder(); private Border dragOverBorder = BorderFactory.createBevelBorder(1); private boolean checkValidDrag(DropTargetDragEvent dtde) { if (dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor) && (DnDConstants.ACTION_COPY == dtde.getDropAction() || DnDConstants.ACTION_MOVE == dtde.getDropAction())) { dtde.acceptDrag(dtde.getDropAction()); return true; } else { dtde.rejectDrag(); return false; } } public void dragEnter(DropTargetDragEvent dtde) { if (checkValidDrag(dtde)) { SwingUtilities.invokeLater(new Runnable() { public void run() { appContentPanel.setBorder(dragOverBorder); }; }); } } public void dragOver(DropTargetDragEvent dtde) { checkValidDrag(dtde); } public void dropActionChanged(DropTargetDragEvent dtde) { checkValidDrag(dtde); } public void dragExit(DropTargetEvent dte) { SwingUtilities.invokeLater(new Runnable() { public void run() { appContentPanel.setBorder(originalBorder); }; }); } public void drop(DropTargetDropEvent dtde) { if (dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor) && (DnDConstants.ACTION_COPY == dtde.getDropAction() || DnDConstants.ACTION_MOVE == dtde.getDropAction())) { dtde.acceptDrop(dtde.getDropAction()); SwingUtilities.invokeLater(new Runnable() { public void run() { appContentPanel.setBorder(originalBorder); }; }); try { final List fileList = (List) dtde.getTransferable() .getTransferData(DataFlavor.javaFileListFlavor); if (fileList != null && fileList.size() > 0) { if (checkProposedUploadFiles(fileList)) { wizardStepForward(); } } } catch (Exception e) { String errorMessage = "Unable to accept dropped item"; log.error(errorMessage, e); ErrorDialog.showDialog(ownerFrame, null, uploaderProperties.getProperties(), errorMessage, e); } } else { dtde.rejectDrop(); } } }; // Attach drop target listener to each target component. for (int i = 0; i < dropTargetComponents.length; i++) { new DropTarget(dropTargetComponents[i], DnDConstants.ACTION_COPY, dropTargetListener, true); } }
From source file:org.jets3t.apps.cockpitlite.CockpitLite.java
/** * Initialise the application's File drop targets for drag and drop copying of local files * to S3.//from w w w .j av a 2s. c om * * @param dropTargetComponents * the components files can be dropped on to transfer them to S3 */ private void initDropTarget(JComponent[] dropTargetComponents) { DropTargetListener dropTargetListener = new DropTargetListener() { private boolean checkValidDrag(DropTargetDragEvent dtde) { if (dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor) && (DnDConstants.ACTION_COPY == dtde.getDropAction() || DnDConstants.ACTION_MOVE == dtde.getDropAction())) { dtde.acceptDrag(dtde.getDropAction()); return true; } else { dtde.rejectDrag(); return false; } } public void dragEnter(DropTargetDragEvent dtde) { if (checkValidDrag(dtde)) { SwingUtilities.invokeLater(new Runnable() { public void run() { objectsTable.requestFocusInWindow(); }; }); } } public void dragOver(DropTargetDragEvent dtde) { checkValidDrag(dtde); } public void dropActionChanged(DropTargetDragEvent dtde) { if (checkValidDrag(dtde)) { SwingUtilities.invokeLater(new Runnable() { public void run() { objectsTable.requestFocusInWindow(); }; }); } else { SwingUtilities.invokeLater(new Runnable() { public void run() { ownerFrame.requestFocusInWindow(); }; }); } } public void dragExit(DropTargetEvent dte) { SwingUtilities.invokeLater(new Runnable() { public void run() { ownerFrame.requestFocusInWindow(); }; }); } public void drop(DropTargetDropEvent dtde) { if (dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor) && (DnDConstants.ACTION_COPY == dtde.getDropAction() || DnDConstants.ACTION_MOVE == dtde.getDropAction())) { dtde.acceptDrop(dtde.getDropAction()); try { final List fileList = (List) dtde.getTransferable() .getTransferData(DataFlavor.javaFileListFlavor); if (fileList != null && fileList.size() > 0) { new Thread() { @Override public void run() { prepareForFilesUpload((File[]) fileList.toArray(new File[fileList.size()])); } }.start(); } } catch (Exception e) { String message = "Unable to start accept dropped item(s)"; log.error(message, e); ErrorDialog.showDialog(ownerFrame, null, cockpitLiteProperties.getProperties(), message, e); } } else { dtde.rejectDrop(); } } }; // Attach drop target listener to each target component. for (int i = 0; i < dropTargetComponents.length; i++) { new DropTarget(dropTargetComponents[i], DnDConstants.ACTION_COPY, dropTargetListener, true); } }
From source file:org.jets3t.apps.cockpit.Cockpit.java
/** * Initialise the application's File drop targets for drag and drop copying of local files * to S3./*from w ww .j a v a 2 s. c om*/ * * @param dropTargetComponents * the components files can be dropped on to transfer them to S3 */ private void initDropTarget(JComponent[] dropTargetComponents) { DropTargetListener dropTargetListener = new DropTargetListener() { private boolean checkValidDrag(DropTargetDragEvent dtde) { if (dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor) && (DnDConstants.ACTION_COPY == dtde.getDropAction() || DnDConstants.ACTION_MOVE == dtde.getDropAction())) { dtde.acceptDrag(dtde.getDropAction()); return true; } else { dtde.rejectDrag(); return false; } } public void dragEnter(DropTargetDragEvent dtde) { if (checkValidDrag(dtde)) { SwingUtilities.invokeLater(new Runnable() { public void run() { objectsTable.requestFocusInWindow(); }; }); } } public void dragOver(DropTargetDragEvent dtde) { checkValidDrag(dtde); } public void dropActionChanged(DropTargetDragEvent dtde) { if (checkValidDrag(dtde)) { SwingUtilities.invokeLater(new Runnable() { public void run() { objectsTable.requestFocusInWindow(); }; }); } else { SwingUtilities.invokeLater(new Runnable() { public void run() { ownerFrame.requestFocusInWindow(); }; }); } } public void dragExit(DropTargetEvent dte) { SwingUtilities.invokeLater(new Runnable() { public void run() { ownerFrame.requestFocusInWindow(); }; }); } public void drop(DropTargetDropEvent dtde) { if (dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor) && (DnDConstants.ACTION_COPY == dtde.getDropAction() || DnDConstants.ACTION_MOVE == dtde.getDropAction())) { dtde.acceptDrop(dtde.getDropAction()); try { final List fileList = (List) dtde.getTransferable() .getTransferData(DataFlavor.javaFileListFlavor); if (fileList != null && fileList.size() > 0) { uploadFiles((File[]) fileList.toArray(new File[fileList.size()])); } } catch (Exception e) { String message = "Unable to start accept dropped items"; log.error(message, e); ErrorDialog.showDialog(ownerFrame, null, message, e); } } else { dtde.rejectDrop(); } } }; // Attach drop target listener to each target component. for (int i = 0; i < dropTargetComponents.length; i++) { new DropTarget(dropTargetComponents[i], DnDConstants.ACTION_COPY, dropTargetListener, true); } }
From source file:com.emental.mindraider.ui.frames.MindRaiderMainWindow.java
public void drop(DropTargetDropEvent evt) { logger.debug("=-> drop"); try {//from ww w . j av a2 s . c o m Transferable t = evt.getTransferable(); if (t.isDataFlavorSupported(DataFlavor.stringFlavor)) { logger.debug(" Accepting 'string' data flavor..."); evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE); String s = (String) t.getTransferData(DataFlavor.stringFlavor); evt.getDropTargetContext().dropComplete(true); logger.debug("DnD: '" + s + "'"); if (s != null) { int indexOf = s.indexOf("\n"); if (indexOf != -1) { dragAndDropReference = new DragAndDropReference(s.substring(indexOf + 1), s.substring(0, indexOf), DragAndDropReference.BROWSER_LINK); } else { dragAndDropReference = new DragAndDropReference(s, DragAndDropReference.BROWSER_LINK); } } } else { if (t.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) { logger.debug(" Accepting 'file list' data flavor..."); evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE); List<Object> list = (List<Object>) t.getTransferData(DataFlavor.javaFileListFlavor); if (list != null) { Iterator<Object> iterator = list.iterator(); while (iterator.hasNext()) { Object next = iterator.next(); if (next instanceof File) { logger.debug(" DnD file: " + next); dragAndDropReference = new DragAndDropReference(((File) next).getAbsolutePath(), DragAndDropReference.EXPLORER_LINK); } } } } else { logger.debug("DnD rejected! "); dragAndDropReference = null; // DataFlavor[] dfs=t.getTransferDataFlavors(); // for (int i = 0; i < dfs.length; i++) { // logger.debug(" "+i+" ... "+dfs[i].getMimeType()); // logger.debug(" "+i+" ... // "+dfs[i].getDefaultRepresentationClassAsString()); // logger.debug(" "+i+" ... // "+dfs[i].getHumanPresentableName()); // } } } } catch (Exception e) { logger.debug("Drag&Drop error:", e); dragAndDropReference = null; } OutlineJPanel.getInstance().enableDisableAttachToolbarButton(); if (dragAndDropReference != null) { JOptionPane.showMessageDialog(this, "Dropped local/web resource reference stored! Use \n'clip' icon from Notebook outline toolbar to attach it.", "Drag&Drop Info", JOptionPane.INFORMATION_MESSAGE); dragAndDropReference.debug(); } logger.debug("<-= drop"); }
From source file:com.declarativa.interprolog.gui.ListenerWindow.java
void handlePrologInputDnD(DropTargetDropEvent dtde) { //System.out.println("drop:"+dtde); try {//from www .j av a 2s. c o m Transferable transferable = dtde.getTransferable(); /* DataFlavor[] flavors = transferable.getTransferDataFlavors(); for (int f=0;f<flavors.length;f++) System.out.println("Flavor:"+flavors[f]);*/ int action = dtde.getDropAction(); if (transferable.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) { if (engine.isIdle()) { dtde.acceptDrop(action); final java.util.List files = (java.util.List) transferable .getTransferData(DataFlavor.javaFileListFlavor); dtde.getDropTargetContext().dropComplete(true); boolean allPs = true; for (int f = 0; f < files.size(); f++) { String filename = ((File) files.get(f)).getName(); int dot = filename.lastIndexOf('.'); if (!filename.endsWith(".P")) { allPs = false; break; } } if (!allPs) { errorMessage("All dragged files must be Prolog source files (with a .P extension)"); } else { prologOutput.append("\nReconsulting " + ((files.size() > 1 ? files.size() + " files...\n" : files.size() + " file...\n"))); Runnable r = new Runnable() { public void run() { boolean crashed = false; Toolkit.getDefaultToolkit().sync(); for (int f = 0; f < files.size() && !crashed; f++) { File file = (File) files.get(f); if (!processDraggedFile(file)) { crashed = true; } } if (crashed) { prologOutput.append("...terminated with errors.\n"); } else { prologOutput.append("...done.\n"); } } }; SwingUtilities.invokeLater(r); } } else { dtde.rejectDrop(); errorMessage("You can not consult files while Prolog is working"); } } else { dtde.rejectDrop(); } } catch (Exception e) { throw new IPException("Problem dropping:" + e); } }
From source file:javazoom.jlgui.player.amp.Player.java
/** * DnD : Drop implementation.// www .j av a 2s . c o m * Adds all dropped files to the playlist. */ public void drop(DropTargetDropEvent e) { // Check DataFlavor DataFlavor[] dfs = e.getCurrentDataFlavors(); DataFlavor tdf = null; for (int i = 0; i < dfs.length; i++) { if (DataFlavor.javaFileListFlavor.equals(dfs[i])) { tdf = dfs[i]; break; } } // Is file list ? if (tdf != null) { // Accept COPY DnD only. if ((e.getSourceActions() & DnDConstants.ACTION_COPY) != 0) { e.acceptDrop(DnDConstants.ACTION_COPY); } else return; try { Transferable t = e.getTransferable(); Object data = t.getTransferData(tdf); // How many files ? if (data instanceof java.util.List) { java.util.List al = (java.util.List) data; // Read the first File. if (al.size() > 0) { File file = null; // Stops the player if needed. if ((playerState == PLAY) || (playerState == PAUSE)) { theSoundPlayer.stop(); playerState = STOP; } // Clean the playlist. playlist.removeAllItems(); // Add all dropped files to playlist. ListIterator li = al.listIterator(); while (li.hasNext()) { file = (File) li.next(); PlaylistItem pli = null; if (file != null) { pli = new PlaylistItem(file.getName(), file.getAbsolutePath(), -1, true); if (pli != null) playlist.appendItem(pli); } } // Start the playlist from the top. playlist.nextCursor(); fileList.initPlayList(); this.setCurrentSong(playlist.getCursor()); } } else { log.info("Unknown dropped objects"); } } catch (IOException ioe) { log.info("Drop error", ioe); e.dropComplete(false); return; } catch (UnsupportedFlavorException ufe) { log.info("Drop error", ufe); e.dropComplete(false); return; } catch (Exception ex) { log.info("Drop error", ex); e.dropComplete(false); return; } e.dropComplete(true); } }