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

16
LINES

< > BotCompany Repo | #1009349 // listEnableTextDrag

JavaX fragment (include)

import java.awt.datatransfer.*;

static void listEnableTextDrag(final JList list) {
  TransferHandler th = new TransferHandler {
    @Override
    public int getSourceActions(JComponent c) { ret COPY; }

    @Override
    protected Transferable createTransferable(JComponent c) {
      O o = selectedListElement(list);
      //print("Value: " + o);
      return new StringSelection(str(o));
    }
  };
  listEnableDrag(list, th);
}

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: 408 / 426
Version history: 2 change(s)
Referenced in: [show references]