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

17
LINES

< > BotCompany Repo | #1007218 // tableEnableTextDrag

JavaX fragment (include)

1  
import java.awt.datatransfer.*;
2  
3  
static void tableEnableTextDrag(final JTable table) {
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  
      //print("Row/Column: " + table.getSelectedRow() + " / " + table.getSelectedColumn());
11  
      O o = selectedTableCell(table);
12  
      //print("Value: " + o);
13  
      return new StringSelection(str(o));
14  
    }
15  
  };
16  
  tableEnableDrag(table, th);
17  
}

Author comment

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: #1007218
Snippet name: tableEnableTextDrag
Eternal ID of this version: #1007218/4
Text MD5: 6274dcef70c2b0cf1091ed719508b2e1
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:56
Source code size: 543 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 591 / 597
Version history: 3 change(s)
Referenced in: [show references]