1 | import java.awt.datatransfer.*; |
2 | |
3 | static class MultiTransferable implements Transferable { |
4 | new L<Transferable> transferables; |
5 | |
6 | public void add(Transferable transferable) { |
7 | transferables.add(transferable); |
8 | } |
9 | |
10 | public DataFlavor[] getTransferDataFlavors() { |
11 | List<DataFlavor> flavors = new ArrayList<DataFlavor>(); |
12 | for (Transferable transferable : transferables) |
13 | flavors.addAll(asList(transferable.getTransferDataFlavors())); |
14 | return flavors.toArray(new DataFlavor[flavors.size()]); |
15 | } |
16 | |
17 | public boolean isDataFlavorSupported(DataFlavor flavor) { |
18 | for (Transferable transferable : transferables) |
19 | if (transferable.isDataFlavorSupported(flavor)) |
20 | return true; |
21 | return false; |
22 | } |
23 | |
24 | public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException { |
25 | for (Transferable transferable : transferables) |
26 | if (transferable.isDataFlavorSupported(flavor)) |
27 | return transferable.getTransferData(flavor); |
28 | return null; |
29 | } |
30 | } |
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: | 463 / 1059 |
Referenced in: | [show references] |