import java.awt.datatransfer.Transferable; static void listEnableDrag(final JList list, TransferHandler th) { if (list.getDragEnabled()) { print("List drag already enabled"); ret; } list.setDragEnabled(true); list.setTransferHandler(th); list.addMouseListener(new MouseAdapter { @Override public void mousePressed(MouseEvent e) { if (e.getButton() == 1 && e.getClickCount() == 1) list.getTransferHandler().exportAsDrag(list, e, TransferHandler.COPY); } }); }
Began life as a copy of #1007217
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: | #1009348 |
Snippet name: | listEnableDrag |
Eternal ID of this version: | #1009348/4 |
Text MD5: | 415d495c835fca71138aa63cd027599a |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-07-24 12:28:50 |
Source code size: | 521 bytes / 17 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 434 / 475 |
Version history: | 3 change(s) |
Referenced in: | [show references] |