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

39
LINES

< > BotCompany Repo | #1006011 // Test making ImageSurface a drag&drop target

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (3599L/25K/82K).

1  
!752
2  
3  
import java.awt.datatransfer.*;
4  
5  
p {
6  
  final new ImageSurface is;
7  
  showFrame(is);
8  
  
9  
  //is.setDragEnabled(true);
10  
  is.setTransferHandler(new TransferHandler {
11  
    protected Transferable createTransferable(JComponent c) {
12  
      print("createTransferable");
13  
      new MultiTransferable multi;
14  
      // todo
15  
      return multi;
16  
    }
17  
18  
    public int getSourceActions(JComponent c) {
19  
      return MOVE;
20  
    }
21  
22  
    @Override
23  
    public boolean canImport(JComponent comp, DataFlavor[] transferFlavors) {
24  
      for (DataFlavor flavor : transferFlavors) {
25  
        print("flavor: " + flavor);
26  
      }
27  
      return false;
28  
    }
29  
30  
    public boolean importData(TransferSupport support) {
31  
      print("importData");
32  
      Transferable t = support.getTransferable();
33  
34  
      //if (t.isDataFlavorSupported(DNDUtil.getObjectDataFlavor())) {
35  
        //data = t.getTransferData(DNDUtil.getObjectDataFlavor());
36  
      return true;
37  
    }
38  
  });
39  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1006011
Snippet name: Test making ImageSurface a drag&drop target
Eternal ID of this version: #1006011/1
Text MD5: e6370eee5dd0a3c91c2c914910ddb2e4
Transpilation MD5: 758293a5b52833c72d0a4ca5d16f9562
Author: stefan
Category: javax / gui
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-12-14 04:58:31
Source code size: 969 bytes / 39 lines
Pitched / IR pitched: No / No
Views / Downloads: 460 / 556
Referenced in: [show references]