List of usage examples for java.awt.dnd DragGestureEvent getComponent
public Component getComponent()
From source file:ComplexExample.java
public void dragGestureRecognized(DragGestureEvent event) { Cursor cursor = null;/* w ww . j av a 2 s .co m*/ JPanel panel = (JPanel) event.getComponent(); Color color = panel.getBackground(); if (event.getDragAction() == DnDConstants.ACTION_COPY) { cursor = DragSource.DefaultCopyDrop; } event.startDrag(cursor, new TransferableColor(color)); }
From source file:de.tor.tribes.ui.algo.AttackTimePanel.java
@Override public void dragGestureRecognized(DragGestureEvent dge) { TimeSpan span = null;//from w w w . j a va 2 s . co m if (dge.getComponent().equals(jLabel5)) { span = getSendSpan(); } else if (dge.getComponent().equals(jLabel6)) { span = getArriveSpan(); } if (span != null) { dge.startDrag(null, new StringSelection(span.toPropertyString()), this); } }