Uses 3874K of libraries. Click here for Pure Java version (4994L/35K/128K).
!7 p-substance { final JTable table = showTable(ll( litorderedmap("Hello" := "World", "How" := "Good"), litorderedmap("Hello" := "Boys", "How" := "Whatever"))); TransferHandler th = new TransferHandler { @Override public int getSourceActions(JComponent c) { return COPY; } @Override protected Transferable createTransferable(JComponent c) { print("Row/Column: " + table.getSelectedRow() + " / " + table.getSelectedColumn()); O o = selectedTableCell(table); print("Value: " + o); return new StringSelection(str(o)); } }; tableEnableDrag(table, th); } svoid tableEnableDrag(final JTable table, TransferHandler th) { table.setDragEnabled(true); table.setTransferHandler(th); table.addMouseListener(new MouseAdapter { @Override public void mousePressed(MouseEvent e) { table.getTransferHandler().exportAsDrag(table, e, TransferHandler.COPY); } }); }
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: | #1007215 |
Snippet name: | Try making JTable a drag source [WORKS] |
Eternal ID of this version: | #1007215/9 |
Text MD5: | 2e67b0759cba0394214dc918f47cf816 |
Transpilation MD5: | a4efa152833d177562a1fc586ede27dd |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-03-12 12:33:26 |
Source code size: | 984 bytes / 35 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 472 / 554 |
Version history: | 8 change(s) |
Referenced in: | #1007216 - Try making JLabel a drag source [dev.] |