Java 8 DragSourceEvent - 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 DragSourceEvent class.

This code example shows how to use the following methods:getDropAction, getDropSuccess, getDragSourceContext
        this.scrolled = scrolled;
    } 
 
    /** Notifies the TransferHandler that the xport is finished. */ 
    public void dragDropEnd(DragSourceDropEvent dsde) {
        DragSourceContext dsc = dsde.getDragSourceContext();
        JComponent c = (JComponent)dsc.getComponent();
        if (dsde.getDropSuccess()) {
            ((LimeTransferHandler)c.getTransferHandler()).exportDone(c, dsc.getTransferable(), dsde.getDropAction());
        } else { 
            ((LimeTransferHandler)c.getTransferHandler()).exportDone(c, dsc.getTransferable(), TransferHandler.NONE);
        } 
        c.setAutoscrolls(scrolled);
    } 
     
    public void dragEnter(DragSourceDragEvent dsde) {}
    public void dragExit(DragSourceEvent dse) {}
    public void dragOver(DragSourceDragEvent dsde) {}
    public void dropActionChanged(DragSourceDragEvent dsde) {}
} 
5
CodeRank
This code example shows how to use the following methods:getDropAction, getDragSourceContext
This code example shows how to use the following methods:getUserAction, getDragSourceContext
 
				public void dragOver(final DragSourceDragEvent dsde) {
				} 
 
				public void dropActionChanged(final DragSourceDragEvent dsde) {
					dsde.getDragSourceContext().setCursor(getCursorByAction(dsde.getUserAction()));
				} 
			}); 
		} 
		catch (final InvalidDnDOperationException ex) {
		} 
	} 
 
	private boolean isLinkDragEvent(final DragGestureEvent e) {
	    return (e.getTriggerEvent().getModifiersEx() & InputEvent.BUTTON3_DOWN_MASK) != 0;
    } 
 
	public Cursor getCursorByAction(final int dragAction) {
		switch (dragAction) {
			case DnDConstants.ACTION_COPY:
5
CodeRank
This code example shows how to use the following methods:getLocation
    { 
        // Saving initial mouse location 
        if ( reference == null || reference.get () != object )
        { 
            final Point los = object.getLocationOnScreen ();
            final Point eloc = event.getLocation ();
            location = new Point ( los.x - eloc.x, los.y - eloc.y ); 
            reference = new WeakReference<T> ( object );
        } 
 
        // Returning component snapshot 
        return SwingUtils.createComponentSnapshot ( object, getSnapshotTransparency () );
    } 
 
    /** 
     * Returns component snapshot transparency. 
     * By default snapshot is semi-transparent for usability purposes. 
     * 
     * @return component snapshot transparency 
     */ 
4
CodeRank
This code example shows how to use the following methods:getDragSourceContext
This code example shows how to use the following methods:getLocation
 
    } 
 
    @Override 
    public void dragMouseMoved(DragSourceDragEvent dsde) {
        drawGlassPane(dsde.getLocation());
    } 
 
    // --- DragSourceListener methods ----------------------------------- 
 
    @Override 
    public void dragEnter(DragSourceDragEvent dsde) {
    } 
 
    @Override 
    public void dragOver(DragSourceDragEvent dsde) {
    } 
 
    @Override 
    public void dragExit(DragSourceEvent dsde) {
3
CodeRank
See Code Examples for Java 8 DragSourceEvent Methods: