Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

16
LINES

< > BotCompany Repo | #1009349 // listEnableTextDrag

JavaX fragment (include)

1  
import java.awt.datatransfer.*;
2  
3  
static void listEnableTextDrag(final JList list) {
4  
  TransferHandler th = new TransferHandler {
5  
    @Override
6  
    public int getSourceActions(JComponent c) { ret COPY; }
7  
8  
    @Override
9  
    protected Transferable createTransferable(JComponent c) {
10  
      O o = selectedListElement(list);
11  
      //print("Value: " + o);
12  
      return new StringSelection(str(o));
13  
    }
14  
  };
15  
  listEnableDrag(list, th);
16  
}

Author comment

Began life as a copy of #1007218

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: #1009349
Snippet name: listEnableTextDrag
Eternal ID of this version: #1009349/3
Text MD5: df69c9e0b1555a693a56f9fc490a0ce3
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-05-20 20:15:41
Source code size: 446 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 410 / 428
Version history: 2 change(s)
Referenced in: [show references]