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).

!752

import java.awt.datatransfer.*;

p {
  final new ImageSurface is;
  showFrame(is);
  
  //is.setDragEnabled(true);
  is.setTransferHandler(new TransferHandler {
    protected Transferable createTransferable(JComponent c) {
      print("createTransferable");
      new MultiTransferable multi;
      // todo
      return multi;
    }

    public int getSourceActions(JComponent c) {
      return MOVE;
    }

    @Override
    public boolean canImport(JComponent comp, DataFlavor[] transferFlavors) {
      for (DataFlavor flavor : transferFlavors) {
        print("flavor: " + flavor);
      }
      return false;
    }

    public boolean importData(TransferSupport support) {
      print("importData");
      Transferable t = support.getTransferable();

      //if (t.isDataFlavorSupported(DNDUtil.getObjectDataFlavor())) {
        //data = t.getTransferData(DNDUtil.getObjectDataFlavor());
      return true;
    }
  });
}

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: 461 / 558
Referenced in: #1006013 - Test making ImageSurface a drag&drop target v2 [WORKS]