Drag and drop sous linux
ayoubnejm
Messages postés
4
Date d'inscription
Statut
Membre
Dernière intervention
-
KX Messages postés 16761 Date d'inscription Statut Modérateur Dernière intervention -
KX Messages postés 16761 Date d'inscription Statut Modérateur Dernière intervention -
Bonjour,
je devais créer une application en java et j'ai rencontré un problème, je vous explique :
je dois faire un drag and drop pour un fichier, quand je le glisse dans un jTable, je récupéré juste son chemin, mais le problème c'est que ça marche sous windows mais pas sous linux,quand je travail sous linux et je glisse le fichier j'obtient son chemin préfixé par file://, comment je fais pour l'enlever sous linux.
Voila un bout de code :
Merci d'avance
je devais créer une application en java et j'ai rencontré un problème, je vous explique :
je dois faire un drag and drop pour un fichier, quand je le glisse dans un jTable, je récupéré juste son chemin, mais le problème c'est que ça marche sous windows mais pas sous linux,quand je travail sous linux et je glisse le fichier j'obtient son chemin préfixé par file://, comment je fais pour l'enlever sous linux.
Voila un bout de code :
public boolean importData(TransferHandler.TransferSupport info) { if (!info.isDrop()) { return false; } Transferable t = info.getTransferable(); // Verifie qu'on a une String flavor if (!info.isDataFlavorSupported(DataFlavor.stringFlavor)) { return false; } // On recherche l'emplacement du drop MyJTable.DropLocation dl = (MyJTable.DropLocation) info .getDropLocation(); int d = dl.getRow(); MyJTable jtab = (MyJTable) info.getComponent(); String s = String.valueOf(jtab.getValueAt(d, 0)); String str = ""; try { str = (String) t.getTransferData(DataFlavor.stringFlavor); } catch (UnsupportedFlavorException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } System.out.println(str + " en " + s); xmlFile.XmlFile.addElement("Playlists/" + s + ".xml", str); return true; } }
Merci d'avance
A voir également:
- Drag and drop sous linux
- Share drop - Télécharger - Téléchargement & Transfert
- Spybot search and destroy - Télécharger - Antivirus & Antimalwares
- Linux reader - Télécharger - Stockage
- Toutou linux - Télécharger - Systèmes d'exploitation
- Find and mount - Télécharger - Récupération de données