import java.awt.datatransfer.*; static class MultiTransferable implements Transferable { new L<Transferable> transferables; public void add(Transferable transferable) { transferables.add(transferable); } public DataFlavor[] getTransferDataFlavors() { List<DataFlavor> flavors = new ArrayList<DataFlavor>(); for (Transferable transferable : transferables) flavors.addAll(asList(transferable.getTransferDataFlavors())); return flavors.toArray(new DataFlavor[flavors.size()]); } public boolean isDataFlavorSupported(DataFlavor flavor) { for (Transferable transferable : transferables) if (transferable.isDataFlavorSupported(flavor)) return true; return false; } public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException { for (Transferable transferable : transferables) if (transferable.isDataFlavorSupported(flavor)) return transferable.getTransferData(flavor); return null; } }
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1006012 |
Snippet name: | MultiTransferable (for drag&drop) |
Eternal ID of this version: | #1006012/1 |
Text MD5: | da79ee7f22d2aabf645bdac0eddd6e00 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-12-14 04:53:54 |
Source code size: | 1034 bytes / 30 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 462 / 1058 |
Referenced in: | #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674) |