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

15
LINES

< > BotCompany Repo | #1007217 // tableEnableDrag

JavaX fragment (include)

1  
static void tableEnableDrag(final JTable table, TransferHandler th) {
2  
  if (table.getDragEnabled()) {
3  
    print("Table drag already enabled");
4  
    ret;
5  
  }
6  
  table.setDragEnabled(true);
7  
  table.setTransferHandler(th);
8  
  table.addMouseListener(new MouseAdapter {
9  
    @Override
10  
    public void mousePressed(MouseEvent e) {
11  
      if (e.getButton() == 1 && e.getClickCount() == 1)
12  
        table.getTransferHandler().exportAsDrag(table, e, TransferHandler.COPY);
13  
    }
14  
  });
15  
}

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: #1007217
Snippet name: tableEnableDrag
Eternal ID of this version: #1007217/10
Text MD5: a39508338551791c510efaa81c1b14de
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-03-22 22:24:42
Source code size: 485 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 544 / 547
Version history: 9 change(s)
Referenced in: [show references]