/** * Initializes a drag source context. * * @exception IllegalArgumentException If Component or DragSource of trigger are null, the drag * action for the trigger event is DnDConstants.ACTION_NONE or if the source actions for the * DragGestureRecognizer associated with the trigger event are equal to * DnDConstants.ACTION_NONE. * @exception NullPointerException If peer or trigger is null. */ public DragSourceContext( DragSourceContextPeer peer, DragGestureEvent trigger, Cursor cursor, Image image, Point offset, Transferable trans, DragSourceListener dsl) { if (peer == null || trigger == null) throw new NullPointerException(); if (trigger.getComponent() == null || trigger.getDragSource() == null || trigger.getDragAction() == DnDConstants.ACTION_NONE || trigger.getSourceAsDragGestureRecognizer().getSourceActions() == DnDConstants.ACTION_NONE) throw new IllegalArgumentException(); this.peer = peer; this.trigger = trigger; this.cursor = cursor; this.image = image; this.offset = offset; this.transferable = trans; this.dragSourceListener = dsl; throw new Error("not implemented"); }
@Override public void dragGestureRecognized(DragGestureEvent dge) { Cursor cursor = null; VariablePanel pp = (VariablePanel) dge.getComponent(); BufferedImage bi = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB); paint(bi.getGraphics()); ImageMover.start(bi, MouseInfo.getPointerInfo().getLocation()); String s = "[VARIABLE]" + pp.s; if (dge.getDragAction() == DnDConstants.ACTION_COPY) { cursor = DragSource.DefaultCopyDrop; } dge.startDrag( cursor, new SimpleDragObject.TransferableSimpleDragObject(new SimpleDragObject(s))); }
public Component getComponent() { return trigger.getComponent(); }