Java 8 DropTarget - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 DropTarget class.

This code example shows how to use the following methods:setDefaultActions
 
        return null; 
    } 
 
    public static void addDropTarget(Component component, AbstractSoapUIDropTarget target) {
        DropTarget dropTarget = new DropTarget(component, target);
        dropTarget.setDefaultActions(DnDConstants.ACTION_COPY_OR_MOVE);
    } 
} 
5
CodeRank
This code example shows how to use the following methods:
	/** 
	 * enables Drag and Drop for this listener 
	 */ 
	public void enableDnD(){ 
		if(dropTarget==null)
			dropTarget = new DropTarget(table ,this);
	} 
	  
	 
	public void dragEnter(DropTargetDragEvent dtde) {
		// TODO Auto-generated method stub 
	} 
 
	public void dragExit(DropTargetEvent dte) {
		// TODO Auto-generated method stub 
	} 
 
	public void dragOver(DropTargetDragEvent dtde) {
		// TODO Auto-generated method stub 
	} 
4
CodeRank
This code example shows how to use the following methods:
		final JScrollPane scrollPane = new JScrollPane(this.tree);
		this.setLayout(new BorderLayout());
		this.add(scrollPane, BorderLayout.CENTER);
 
		this.tree.updateUI();
		dt = new DropTarget(this, this);
 
	} 
 
	public List<ProjectItem> getSelectedValue() {
 
		List<ProjectItem> result = new ArrayList<ProjectItem>();
		TreePath[] path = this.tree.getSelectionPaths();
 
		if (path == null || path.length == 0)
			return null; 
 
		for (int i = 0; i < path.length; i++) {
			Object obj = path[i].getLastPathComponent();
			if (obj instanceof ProjectItem) 
3
CodeRank
This code example shows how to use the following methods:
 
	private static final long serialVersionUID = 1L;
 
	public HopperDropableJTable(TableModel dm) {
		super(dm);
	    new DropTarget(this, this);
	} 
	 
	//-- Implementation of interface DropTargetListener --- 
	 
	private static final String URI_LIST_MIME_TYPE = "text/uri-list;class=java.lang.String";
	 
	public void dragEnter(DropTargetDragEvent event) {
		if (isEnabled()) {
			event.acceptDrag(DnDConstants.ACTION_MOVE);
		} else { 
			event.rejectDrag();
		} 
	} 
	public void dragOver(DropTargetDragEvent event) {}
4
CodeRank
This code example shows how to use the following methods:
    if (this.dropTarget != null)
    { 
      dropTarget.removeDropTargetListener(this);
    } 
    this.component = c;
    this.dropTarget = new DropTarget(this.component, this);
  } 
 
  public JComponent getComponent()
  { 
    return this.component;
  } 
  protected List<File> droppedFiles = null;
  public static final String PROP_DROPPEDFILES = "droppedFiles";
 
  /** 
   * Get the value of droppedFiles 
   * 
   * @return the value of droppedFiles 
   */ 
3
CodeRank
This code example shows how to use the following methods:
        //this.setModel(model); 
 
        src = new DragSource();
        src.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_MOVE, this);
 
        tgt = new DropTarget(this, this);
 
        movingItems = false;
        overIndex = -1;
    } 
 
    @SuppressWarnings("unchecked") 
    @Override 
    public DnDListModel<T> getModel() { 
        return (DnDListModel<T>) super.getModel(); 
    } 
    /** 
     * Called by the system when a drag gesture starts 
     */ 
    @Override 
4
CodeRank
This code example shows how to use the following methods:
    public MessageViewTopComponent() { 
        initComponents(); 
        setName(NbBundle.getMessage(MessageViewTopComponent.class, "CTL_MessageViewTopComponent")); 
        setToolTipText(NbBundle.getMessage(MessageViewTopComponent.class, "HINT_MessageViewTopComponent")); 
 
        DropTarget dt = new DropTarget(jTable1, new MessageSignalDropAdapter(model));
	jTable1.setDropTarget(dt);
 
        DefaultTableCellRenderer rightRenderer = new DefaultTableCellRenderer();
        rightRenderer.setHorizontalAlignment( JLabel.RIGHT);
        TableColumnModel cm = jTable1.getColumnModel();
 
        cm.getColumn(1).setCellRenderer(rightRenderer);
        cm.getColumn(4).setCellRenderer(rightRenderer);
 
    } 
 
    /** This method is called from within the constructor to 
     * initialize the form. 
     * WARNING: Do NOT modify this code. The content of this method is 
4
CodeRank
This code example shows how to use the following methods:
 
	private static final long serialVersionUID = 1L;
 
	public JatkDropableJTable(TableModel dm) {
		super(dm);
		new DropTarget(this, this);
	} 
	 
	//-- Implementation of interface DropTargetListener --- 
	 
	private static final String URI_LIST_MIME_TYPE = "text/uri-list;class=java.lang.String";
	 
	public void dragEnter(DropTargetDragEvent event) {
		if (isEnabled()) {
			event.acceptDrag(DnDConstants.ACTION_COPY);
		} else { 
			event.rejectDrag();
		} 
	} 
	public void dragOver(DropTargetDragEvent event) {}
4
CodeRank
This code example shows how to use the following methods:
		tree.setDragEnabled(false);
		tree.setTransferHandler(null);
		tree.addMouseListener(this);
		tree.addKeyListener(this);
		DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(tree, DnDConstants.ACTION_COPY_OR_MOVE, this);
		new DropTarget(tree, this);
 
		reset(); 
	} 
	public JTree getTree()
	{ 
		return tree;
	} 
	 
	public void reset() 
	{ 
		contextNode = null;
		copyAction.setContextNode(null);
		popup.removeAll();
		if(popup.isVisible())
3
CodeRank
This code example shows how to use the following methods:
 
    public TreeDropTarget(JTree tree, ProjectController eventController, TreePath parentPath) {
        targetTree = tree;
        this.eventController = eventController;
        this.parentPath = parentPath;
        target = new DropTarget(targetTree, this);
    } 
 
 
    public void dragEnter(DropTargetDragEvent dtde) {
    } 
 
    public void dragOver(DropTargetDragEvent dtde) {
        Point p = dtde.getLocation();
        targetPath = targetTree.getPathForLocation(p.x, p.y);
    } 
 
    public void dragExit(DropTargetEvent dte) {
    } 
 
4
CodeRank
See Code Examples for Java 8 DropTarget Methods: