Java Code Examples for java.awt.dnd.DropTarget

The following examples show how to use java.awt.dnd.DropTarget. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
@Override
public void addDropTarget(DropTarget dt) {
    LWWindowPeer winPeer = getWindowPeerOrSelf();
    if (winPeer != null && winPeer != this) {
        // We need to register the DropTarget in the
        // peer of the window ancestor of the component
        winPeer.addDropTarget(dt);
    } else {
        synchronized (dropTargetLock) {
            // 10-14-02 VL: Windows WComponentPeer would add (or remove) the drop target only
            // if it's the first (or last) one for the component. Otherwise this call is a no-op.
            if (++fNumDropTargets == 1) {
                // Having a non-null drop target would be an error but let's check just in case:
                if (fDropTarget != null)
                    System.err.println("CComponent.addDropTarget(): current drop target is non-null.");

                // Create a new drop target:
                fDropTarget = CDropTarget.createDropTarget(dt, target, this);
            }
        }
    }
}
 
Example 2
protected AbstractTreeTransferHandler(DNDTree tree, int action, boolean drawIcon) {
    this.tree = tree;
    drawImage = drawIcon;

    if (!GraphicsEnvironment.getLocalGraphicsEnvironment().isHeadlessInstance())
    {
        dragSource = new DragSource();
        dgr = dragSource.createDefaultDragGestureRecognizer(tree, action, this);
        dropTarget = new DropTarget(tree, action, this);
    }
    else
    {
        dragSource = null;
        dgr = null;
        dropTarget = null;
    }
}
 
Example 3
Source Project: hottub   Source File: LWComponentPeer.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public void addDropTarget(DropTarget dt) {
    LWWindowPeer winPeer = getWindowPeerOrSelf();
    if (winPeer != null && winPeer != this) {
        // We need to register the DropTarget in the
        // peer of the window ancestor of the component
        winPeer.addDropTarget(dt);
    } else {
        synchronized (dropTargetLock) {
            // 10-14-02 VL: Windows WComponentPeer would add (or remove) the drop target only
            // if it's the first (or last) one for the component. Otherwise this call is a no-op.
            if (++fNumDropTargets == 1) {
                // Having a non-null drop target would be an error but let's check just in case:
                if (fDropTarget != null)
                    System.err.println("CComponent.addDropTarget(): current drop target is non-null.");

                // Create a new drop target:
                fDropTarget = CDropTarget.createDropTarget(dt, target, this);
            }
        }
    }
}
 
Example 4
@Override
public void removeDropTarget(DropTarget dt) {
    LWWindowPeer winPeer = getWindowPeerOrSelf();
    if (winPeer != null && winPeer != this) {
        // We need to unregister the DropTarget in the
        // peer of the window ancestor of the component
        winPeer.removeDropTarget(dt);
    } else {
        synchronized (dropTargetLock){
            // 10-14-02 VL: Windows WComponentPeer would add (or remove) the drop target only
            // if it's the first (or last) one for the component. Otherwise this call is a no-op.
            if (--fNumDropTargets == 0) {
                // Having a null drop target would be an error but let's check just in case:
                if (fDropTarget != null) {
                    // Dispose of the drop target:
                    fDropTarget.dispose();
                    fDropTarget = null;
                } else
                    System.err.println("CComponent.removeDropTarget(): current drop target is null.");
            }
        }
    }
}
 
Example 5
Source Project: jdk8u-jdk   Source File: LWComponentPeer.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public void removeDropTarget(DropTarget dt) {
    LWWindowPeer winPeer = getWindowPeerOrSelf();
    if (winPeer != null && winPeer != this) {
        // We need to unregister the DropTarget in the
        // peer of the window ancestor of the component
        winPeer.removeDropTarget(dt);
    } else {
        synchronized (dropTargetLock){
            // 10-14-02 VL: Windows WComponentPeer would add (or remove) the drop target only
            // if it's the first (or last) one for the component. Otherwise this call is a no-op.
            if (--fNumDropTargets == 0) {
                // Having a null drop target would be an error but let's check just in case:
                if (fDropTarget != null) {
                    // Dispose of the drop target:
                    fDropTarget.dispose();
                    fDropTarget = null;
                } else
                    System.err.println("CComponent.removeDropTarget(): current drop target is null.");
            }
        }
    }
}
 
Example 6
private static void initAndShowUI() {
    frame = new JFrame("Test frame");

    frame.setSize(SIZE, SIZE);
    frame.setLocationRelativeTo(null);
    final JTextArea jta = new JTextArea();
    jta.setBackground(Color.RED);
    frame.add(jta);
    jta.setText("1234567890");
    jta.setFont(jta.getFont().deriveFont(150f));
    jta.setDragEnabled(true);
    jta.selectAll();
    jta.setDropTarget(new DropTarget(jta, DnDConstants.ACTION_COPY,
                                     new TestdropTargetListener()));
    jta.addMouseListener(new TestMouseAdapter());
    frame.setVisible(true);
}
 
Example 7
@Override
public void removeDropTarget(DropTarget dt) {
    LWWindowPeer winPeer = getWindowPeerOrSelf();
    if (winPeer != null && winPeer != this) {
        // We need to unregister the DropTarget in the
        // peer of the window ancestor of the component
        winPeer.removeDropTarget(dt);
    } else {
        synchronized (dropTargetLock){
            // 10-14-02 VL: Windows WComponentPeer would add (or remove) the drop target only
            // if it's the first (or last) one for the component. Otherwise this call is a no-op.
            if (--fNumDropTargets == 0) {
                // Having a null drop target would be an error but let's check just in case:
                if (fDropTarget != null) {
                    // Dispose of the drop target:
                    fDropTarget.dispose();
                    fDropTarget = null;
                } else
                    System.err.println("CComponent.removeDropTarget(): current drop target is null.");
            }
        }
    }
}
 
Example 8
private static void initAndShowUI() {
    frame = new JFrame("Test frame");

    frame.setSize(SIZE, SIZE);
    frame.setLocationRelativeTo(null);
    final JTextArea jta = new JTextArea();
    jta.setBackground(Color.RED);
    frame.add(jta);
    jta.setText("1234567890");
    jta.setFont(jta.getFont().deriveFont(150f));
    jta.setDragEnabled(true);
    jta.selectAll();
    jta.setDropTarget(new DropTarget(jta, DnDConstants.ACTION_COPY,
                                     new TestdropTargetListener()));
    jta.addMouseListener(new TestMouseAdapter());
    frame.setVisible(true);
}
 
Example 9
private static void initAndShowUI() {
    frame = new JFrame("Test frame");

    frame.setSize(SIZE, SIZE);
    frame.setLocationRelativeTo(null);
    final JTextArea jta = new JTextArea();
    jta.setBackground(Color.RED);
    frame.add(jta);
    jta.setText("1234567890");
    jta.setFont(jta.getFont().deriveFont(150f));
    jta.setDragEnabled(true);
    jta.selectAll();
    jta.setDropTarget(new DropTarget(jta, DnDConstants.ACTION_COPY,
                                     new TestdropTargetListener()));
    jta.addMouseListener(new TestMouseAdapter());
    frame.setVisible(true);
}
 
Example 10
private static void initAndShowUI() {
    frame = new JFrame("Test frame");

    frame.setSize(SIZE, SIZE);
    frame.setLocationRelativeTo(null);
    final JTextArea jta = new JTextArea();
    jta.setBackground(Color.RED);
    frame.add(jta);
    jta.setText("1234567890");
    jta.setFont(jta.getFont().deriveFont(150f));
    jta.setDragEnabled(true);
    jta.selectAll();
    jta.setDropTarget(new DropTarget(jta, DnDConstants.ACTION_COPY,
                                     new TestdropTargetListener()));
    jta.addMouseListener(new TestMouseAdapter());
    frame.setVisible(true);
}
 
Example 11
/**
 * Could be called when DnD enters a heavyweight or synthesized in processMotionMessage
 */
@Override
protected void processEnterMessage(SunDropTargetEvent event) {
    Component c = event.getComponent();
    DropTarget dt = event.getComponent().getDropTarget();
    if (isEventInsideTarget(event)
            && dt != insideTarget
            && c.isShowing()
            && dt != null
            && dt.isActive()) {
        insideTarget = dt;
        super.processEnterMessage(event);
    }
}
 
Example 12
Source Project: darklaf   Source File: DarkTabbedPaneUI.java    License: MIT License 5 votes vote down vote up
protected void installDragSupport() {
    tabPane.setTransferHandler(TRANSFER_HANDLER);
    try {
        DropTarget target = tabPane.getDropTarget();
        if (target != null) {
            target.addDropTargetListener(TRANSFER_HANDLER);
            target.setActive(dndEnabled);
        }
    } catch (TooManyListenersException e) {
        e.printStackTrace();
    }
}
 
Example 13
Source Project: hottub   Source File: XComponentPeer.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void removeDropTarget(DropTarget dt) {
    Component comp = target;
    while(!(comp == null || comp instanceof Window)) {
        comp = comp.getParent();
    }

    if (comp instanceof Window) {
        XWindowPeer wpeer = (XWindowPeer)(comp.getPeer());
        if (wpeer != null) {
            wpeer.removeDropTarget();
        }
    }
}
 
Example 14
Source Project: blog-codes   Source File: EditorRuler.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Constructs a new ruler for the specified graph and orientation.
 * 
 * @param graph
 *            The graph to create the ruler for.
 * @param orientation
 *            The orientation to use for the ruler.
 */
public EditorRuler(mxGraphComponent graphComponent, int orientation)
{
	this.orientation = orientation;
	this.graphComponent = graphComponent;
	updateIncrementAndUnits();

	graphComponent.getGraph().getView().addListener(
			mxEvent.SCALE, repaintHandler);
	graphComponent.getGraph().getView().addListener(
			mxEvent.TRANSLATE, repaintHandler);
	graphComponent.getGraph().getView().addListener(
			mxEvent.SCALE_AND_TRANSLATE, repaintHandler);

	graphComponent.getGraphControl().addMouseMotionListener(this);

	DropTarget dropTarget = graphComponent.getDropTarget();

	try
	{
		if (dropTarget != null)
		{
			dropTarget.addDropTargetListener(this);
		}
	}
	catch (TooManyListenersException tmle)
	{
		// should not happen... swing drop target is multicast
	}

	setBorder(BorderFactory.createLineBorder(Color.black));
}
 
Example 15
/****** DropTargetPeer implementation ********************/

    public void addDropTarget(DropTarget dt) {
        Component comp = target;
        while(!(comp == null || comp instanceof Window)) {
            comp = comp.getParent();
        }

        if (comp instanceof Window) {
            XWindowPeer wpeer = (XWindowPeer)(comp.getPeer());
            if (wpeer != null) {
                wpeer.addDropTarget();
            }
        }
    }
 
Example 16
/**
 * Installs a {@code DropTarget} on the component as necessary for a
 * {@code TransferHandler} change.
 */
static void installSwingDropTargetAsNecessary(Component c,
                                                     TransferHandler t) {

    if (!getSuppressDropTarget()) {
        DropTarget dropHandler = c.getDropTarget();
        if ((dropHandler == null) || (dropHandler instanceof UIResource)) {
            if (t == null) {
                c.setDropTarget(null);
            } else if (!GraphicsEnvironment.isHeadless()) {
                c.setDropTarget(new TransferHandler.SwingDropTarget(c));
            }
        }
    }
}
 
Example 17
Source Project: TencentKona-8   Source File: XComponentPeer.java    License: GNU General Public License v2.0 5 votes vote down vote up
/****** DropTargetPeer implementation ********************/

    public void addDropTarget(DropTarget dt) {
        Component comp = target;
        while(!(comp == null || comp instanceof Window)) {
            comp = comp.getParent();
        }

        if (comp instanceof Window) {
            XWindowPeer wpeer = (XWindowPeer)(comp.getPeer());
            if (wpeer != null) {
                wpeer.addDropTarget();
            }
        }
    }
 
Example 18
Source Project: MobyDroid   Source File: JPanel_FileManager.java    License: Apache License 2.0 5 votes vote down vote up
/**
 *
 */
private void dropHandle() {
    // Handle drag & drop files into jPanel
    jPanel_Device.setDropTarget(new DropTarget() {
        @Override
        public synchronized void drop(DropTargetDropEvent dtde) {
            // disable UI
            try {
                // set accepted drop action
                dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
                // Just going to grab the expected DataFlavor to make sure
                // we know what is being dropped
                // Grab expected flavor
                DataFlavor dragAndDropPanelFlavor = DataFlavor.javaFileListFlavor;
                // What does the Transferable support
                if (dtde.getTransferable().isDataFlavorSupported(dragAndDropPanelFlavor)) {
                    Object transferableArrayListObj = dtde.getTransferable().getTransferData(dragAndDropPanelFlavor);
                    if (transferableArrayListObj != null) {
                        if (transferableArrayListObj instanceof ArrayList) {
                            // copyHandle
                            List<MyFile> src = new ArrayList<>();
                            ((ArrayList) transferableArrayListObj).forEach(file -> {
                                String srcFile = ((File) file).getAbsolutePath();
                                src.add(new MyFile(srcFile, 0, 0, 0));
                            });
                            // copy from local
                            fileBrowserLocal.onCopy(src);
                            // paste to device
                            fileBrowserDevice.onPaste();
                        }
                    }
                }
            } catch (UnsupportedFlavorException | IOException ex) {
                Log.log(Level.SEVERE, "DropItHandle", ex);
            }
            // handle drop inside current panel
            //super.drop(dtde);*/
        }
    });
}
 
Example 19
Source Project: TencentKona-8   Source File: WComponentPeer.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * unregister a DropTarget with this native peer
 */

@Override
public synchronized void removeDropTarget(DropTarget dt) {
    nDropTargets--;
    if (nDropTargets == 0) {
        removeNativeDropTarget();
        nativeDropTargetContext = 0;
    }
}
 
Example 20
Source Project: marathonv5   Source File: DnDHandler.java    License: Apache License 2.0 5 votes vote down vote up
private DropTargetContext createDropTargetContext() throws SecurityException, NoSuchMethodException, IllegalArgumentException,
        InstantiationException, IllegalAccessException, InvocationTargetException {
    Constructor<DropTargetContext> c = DropTargetContext.class.getDeclaredConstructor(DropTarget.class);
    c.setAccessible(true);
    DropTargetContext inst = c.newInstance(dest.getDropTarget());
    inst.addNotify(createDropTargetContextPeer());
    return inst;
}
 
Example 21
Source Project: jdk8u-jdk   Source File: WComponentPeer.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * unregister a DropTarget with this native peer
 */

@Override
public synchronized void removeDropTarget(DropTarget dt) {
    nDropTargets--;
    if (nDropTargets == 0) {
        removeNativeDropTarget();
        nativeDropTargetContext = 0;
    }
}
 
Example 22
Source Project: uima-uimaj   Source File: StyleMapTable.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Instantiates a new style map table.
 *
 * @param model the model
 * @param av the av
 * @param edit the edit
 * @param tmed the tmed
 */
public StyleMapTable(TableModel model, AnnotationFeaturesViewer av, StyleMapEditor edit,
        TableGUIMediator tmed) {
  super(model);
  med = tmed;
  setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
  setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  setDropTarget(new DropTarget(this, new TableDropAdapter(av, edit)));

  getTableHeader().setReorderingAllowed(false);
  ListSelectionModel lsm = this.getSelectionModel();
  lsm.addListSelectionListener(new TableSelectionListener(med));
}
 
Example 23
Source Project: jdk8u_jdk   Source File: WComponentPeer.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * unregister a DropTarget with this native peer
 */

@Override
public synchronized void removeDropTarget(DropTarget dt) {
    nDropTargets--;
    if (nDropTargets == 0) {
        removeNativeDropTarget();
        nativeDropTargetContext = 0;
    }
}
 
Example 24
Source Project: netbeans   Source File: IndexedCustomizer.java    License: Apache License 2.0 5 votes vote down vote up
/** Creates the instance, makes given component active for
* drop operation. */
IndexedDropTarget(IndexedCustomizer dialog, IndexedDragSource ids) {
    this.dialog = dialog;
    this.comp = dialog.control;
    this.cellRenderer = (IndexedListCellRenderer) this.comp.getCellRenderer();
    this.ids = ids;
    new DropTarget(comp, DnDConstants.ACTION_MOVE, this, true);
}
 
Example 25
Source Project: Method_Trace_Tool   Source File: Trace.java    License: Apache License 2.0 5 votes vote down vote up
public static void drag()//定义的拖拽方法
{
    //panel表示要接受拖拽的控件
    new DropTarget(JlPath, DnDConstants.ACTION_COPY_OR_MOVE, new DropTargetAdapter() {
        public void drop(DropTargetDropEvent dtde)//重写适配器的drop方法
        {
            try {
                if (dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor))//如果拖入的文件格式受支持
                {
                    dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);//接收拖拽来的数据
                    List<File> list = (List<File>) (dtde.getTransferable().getTransferData(DataFlavor.javaFileListFlavor));
                    String temp = "";
                    for (File file : list) {
                        temp = file.getAbsolutePath();
                        JlPath.setText(temp);
                        break;
                    }
                    //JOptionPane.showMessageDialog(null, temp);
                    dtde.dropComplete(true);//指示拖拽操作已完成
                } else {
                    dtde.rejectDrop();//否则拒绝拖拽来的数据
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}
 
Example 26
Source Project: hottub   Source File: WComponentPeer.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * unregister a DropTarget with this native peer
 */

@Override
public synchronized void removeDropTarget(DropTarget dt) {
    nDropTargets--;
    if (nDropTargets == 0) {
        removeNativeDropTarget();
        nativeDropTargetContext = 0;
    }
}
 
Example 27
Source Project: netbeans   Source File: DnDSupport.java    License: Apache License 2.0 5 votes vote down vote up
void add( CategoryDescriptor descriptor ) {
    CategoryList list = descriptor.getList();
    list.setTransferHandler( null );
    list.setDragEnabled(false);
    recognizers.add( DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer( list, DnDConstants.ACTION_MOVE, this ) );
    dropTargets.add( new DropTarget( list, this ) );
    
    CategoryButton button = descriptor.getButton();
    button.setTransferHandler( null );
    recognizers.add( DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer( button, DnDConstants.ACTION_MOVE, this ) );
    dropTargets.add( new DropTarget( button, this ) );
}
 
Example 28
/**
 * unregister a DropTarget with this native peer
 */

@Override
public synchronized void removeDropTarget(DropTarget dt) {
    nDropTargets--;
    if (nDropTargets == 0) {
        removeNativeDropTarget();
        nativeDropTargetContext = 0;
    }
}
 
Example 29
Source Project: java-swing-tips   Source File: MainPanel.java    License: MIT License 5 votes vote down vote up
private MainPanel() {
  super(new BorderLayout());
  JTabbedPane tabs = new JTabbedPane();
  tabs.addTab("00000000", new JScrollPane(makeList(0)));
  tabs.addTab("11111111", new JScrollPane(makeList(1)));
  tabs.addTab("22222222", new JScrollPane(makeList(2)));
  add(tabs);

  new DropTarget(tabs, DnDConstants.ACTION_MOVE, new TabTitleDropTargetListener(), true);
  setPreferredSize(new Dimension(320, 240));
}
 
Example 30
Source Project: openjdk-8   Source File: WComponentPeer.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * unregister a DropTarget with this native peer
 */

public synchronized void removeDropTarget(DropTarget dt) {
    nDropTargets--;
    if (nDropTargets == 0) {
        removeNativeDropTarget();
        nativeDropTargetContext = 0;
    }
}
 
Example 31
Source Project: jdk8u60   Source File: WComponentPeer.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * unregister a DropTarget with this native peer
 */

@Override
public synchronized void removeDropTarget(DropTarget dt) {
    nDropTargets--;
    if (nDropTargets == 0) {
        removeNativeDropTarget();
        nativeDropTargetContext = 0;
    }
}
 
Example 32
/**
 * Could be called when DnD enters a heavyweight or synthesized in processMotionMessage
 */
@Override
protected void processEnterMessage(SunDropTargetEvent event) {
    Component c = event.getComponent();
    DropTarget dt = event.getComponent().getDropTarget();
    if (isEventInsideTarget(event)
            && dt != insideTarget
            && c.isShowing()
            && dt != null
            && dt.isActive()) {
        insideTarget = dt;
        super.processEnterMessage(event);
    }
}
 
Example 33
Source Project: jdk8u_jdk   Source File: XComponentPeer.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void removeDropTarget(DropTarget dt) {
    Component comp = target;
    while(!(comp == null || comp instanceof Window)) {
        comp = comp.getParent();
    }

    if (comp instanceof Window) {
        XWindowPeer wpeer = (XWindowPeer)(comp.getPeer());
        if (wpeer != null) {
            wpeer.removeDropTarget();
        }
    }
}
 
Example 34
/**
 * Construct Quick Start pane.
 *
 * @param kseFrame
 *            KSE frame
 */
public JQuickStartPane(KseFrame kseFrame) {
	super(GRADIENT_COLOR_1, GRADIENT_COLOR_2);

	this.kseFrame = kseFrame;

	// Make this pane a drop target and its own listener
	new DropTarget(this, this);

	initComponents();
}
 
Example 35
Source Project: netbeans   Source File: DnDSupport.java    License: Apache License 2.0 4 votes vote down vote up
/** Creates a new instance of DnDSupport */
public DnDSupport( PalettePanel palette ) {
    this.palette = palette;
    new DropTarget( palette.getScrollPane(), this );
}
 
Example 36
/**
 *
 */

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;
    }
}
 
Example 37
public void addDropTarget(DropTarget dt) {
    if (content == null) return;
    content.addDropTarget(dt);
}
 
Example 38
Source Project: TrakEM2   Source File: DNDInsertImage.java    License: GNU General Public License v3.0 4 votes vote down vote up
public DNDInsertImage(Display display) {
	this.display = display;
	this.dt = new DropTarget(display.getCanvas(), this);
}
 
Example 39
Source Project: jdk8u-jdk   Source File: Container.java    License: GNU General Public License v2.0 4 votes vote down vote up
public boolean accept(final Component comp) {
    DropTarget dt = comp.getDropTarget();
    return dt != null && dt.isActive();
}
 
Example 40
Source Project: jdk8u_jdk   Source File: Container.java    License: GNU General Public License v2.0 4 votes vote down vote up
public boolean accept(final Component comp) {
    DropTarget dt = comp.getDropTarget();
    return dt != null && dt.isActive();
}