use of java.awt.dnd.DropTargetAdapter in project jdk8u_jdk by JetBrains.
the class ExtraDragEnterTest method initAndShowUI.
private static void initAndShowUI() {
f = new Frame("Test frame");
f.setBounds(FRAME_LOCATION, FRAME_LOCATION, FRAME_SIZE, FRAME_SIZE);
mainPanel = new Panel();
mainPanel.setBounds(0, 0, FRAME_SIZE, FRAME_SIZE);
mainPanel.setBackground(Color.black);
mainPanel.setLayout(new GridLayout(2, 1));
final DraggablePanel dragSource = new DraggablePanel();
dragSource.setBackground(Color.yellow);
dragSource.setDropTarget(null);
mainPanel.add(dragSource);
Panel dropTarget = new Panel();
dropTarget.setBackground(Color.red);
DropTarget dt = new DropTarget(dropTarget, new DropTargetAdapter() {
@Override
public void drop(DropTargetDropEvent dtde) {
}
@Override
public void dragEnter(DropTargetDragEvent dtde) {
dragEnterCalled.incrementAndGet();
}
});
dropTarget.setDropTarget(dt);
mainPanel.add(dropTarget);
f.add(mainPanel);
f.setVisible(true);
}
use of java.awt.dnd.DropTargetAdapter 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