use of java.awt.dnd.DropTargetEvent in project android by JetBrains.
the class DropTargetEventBuilder method build.
public DropTargetEvent build() {
DropTargetEvent event = mock(DropTargetEvent.class);
when(event.getSource()).thenReturn(mySource);
when(event.getDropTargetContext()).thenReturn(myDropTargetContext);
return event;
}
use of java.awt.dnd.DropTargetEvent in project jdk8u_jdk by JetBrains.
the class SunDropTargetContextPeer method processExitMessage.
/**
*
*/
protected void processExitMessage(SunDropTargetEvent event) {
Component c = (Component) event.getSource();
DropTarget dt = c.getDropTarget();
DropTargetContext dtc = null;
if (dt == null) {
currentDT = null;
currentT = null;
if (currentDTC != null) {
currentDTC.removeNotify();
}
currentDTC = null;
return;
}
if (dt != currentDT) {
if (currentDTC != null) {
currentDTC.removeNotify();
}
currentDT = dt;
currentDTC = dt.getDropTargetContext();
currentDTC.addNotify(this);
}
dtc = currentDTC;
if (dt.isActive())
try {
((DropTargetListener) dt).dragExit(new DropTargetEvent(dtc));
} catch (Exception e) {
e.printStackTrace();
} finally {
currentA = DnDConstants.ACTION_NONE;
currentSA = DnDConstants.ACTION_NONE;
currentDA = DnDConstants.ACTION_NONE;
currentDT = null;
currentT = null;
currentDTC.removeNotify();
currentDTC = null;
local = null;
dragRejected = false;
}
}
use of java.awt.dnd.DropTargetEvent in project jdk8u_jdk by JetBrains.
the class MissedDragExitTest method initAndShowUI.
private static void initAndShowUI() {
f = new Frame("Test frame");
f.setBounds(FRAME_LOCATION, FRAME_LOCATION, FRAME_SIZE, FRAME_SIZE);
final DraggablePanel dragSource = new DraggablePanel();
dragSource.setBackground(Color.yellow);
DropTarget dt = new DropTarget(dragSource, new DropTargetAdapter() {
@Override
public void drop(DropTargetDropEvent dtde) {
}
@Override
public void dragExit(DropTargetEvent dte) {
dragExitCalled = true;
}
@Override
public void dragOver(DropTargetDragEvent dtde) {
Panel newDropTarget = new Panel();
newDropTarget.setDropTarget(new DropTarget());
newDropTarget.setBackground(Color.red);
newDropTarget.setBounds(0, 0, FRAME_SIZE, FRAME_SIZE);
dragSource.add(newDropTarget);
}
});
dragSource.setDropTarget(dt);
f.add(dragSource);
f.setVisible(true);
}
Aggregations