Search in sources :

Example 6 with DropTargetAdapter

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);
}
Also used : DropTargetAdapter(java.awt.dnd.DropTargetAdapter) DropTargetDragEvent(java.awt.dnd.DropTargetDragEvent) DropTarget(java.awt.dnd.DropTarget) DropTargetDropEvent(java.awt.dnd.DropTargetDropEvent)

Example 7 with DropTargetAdapter

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);
}
Also used : DropTargetAdapter(java.awt.dnd.DropTargetAdapter) DropTargetDragEvent(java.awt.dnd.DropTargetDragEvent) DropTargetEvent(java.awt.dnd.DropTargetEvent) DropTarget(java.awt.dnd.DropTarget) DropTargetDropEvent(java.awt.dnd.DropTargetDropEvent)

Aggregations

DropTargetAdapter (java.awt.dnd.DropTargetAdapter)7 DropTargetDragEvent (java.awt.dnd.DropTargetDragEvent)7 DropTargetDropEvent (java.awt.dnd.DropTargetDropEvent)7 DropTarget (java.awt.dnd.DropTarget)6 EditorFragmentComponent (com.intellij.codeInsight.hint.EditorFragmentComponent)3 JBLayeredPane (com.intellij.ui.components.JBLayeredPane)3 Activatable (com.intellij.util.ui.update.Activatable)3 UiNotifyConnector (com.intellij.util.ui.update.UiNotifyConnector)3 DropTargetEvent (java.awt.dnd.DropTargetEvent)1 Override (java.lang.Override)1 TooManyListenersException (java.util.TooManyListenersException)1 JFrame (javax.swing.JFrame)1 JTextArea (javax.swing.JTextArea)1 Sysout (test.java.awt.regtesthelpers.Sysout)1