类java.awt.dnd.DropTargetListener源码实例Demo

下面列出了怎么用java.awt.dnd.DropTargetListener的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: netbeans   文件: PluginManagerUI.java
private void postInitComponents () {
    Containers.initNotify ();
    updateTable = createTabForModel(new UpdateTableModel(units));
    availableTable = createTabForModel(new AvailableTableModel (units));
    final LocalDownloadSupport localDownloadSupport = new LocalDownloadSupport();
    final LocallyDownloadedTableModel localTM = new LocallyDownloadedTableModel(localDownloadSupport);
    localTable = createTabForModel(localTM);
    installedTable = createTabForModel(new InstalledTableModel(units));

    DropTargetListener l = new LocallDownloadDnD(localDownloadSupport, localTM, this);
    final DropTarget dt = new DropTarget(null, l);
    dt.setActive(true);
    this.setDropTarget(dt);


    final SettingsTab tab = new SettingsTab(this);
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            tpTabs.add(tab, INDEX_OF_SETTINGS_TAB);
            tpTabs.setTitleAt(INDEX_OF_SETTINGS_TAB, tab.getDisplayName());
        }
    });
    setWaitingState(true);
}
 
源代码2 项目: jdk8u-dev-jdk   文件: XEmbedCanvasPeer.java
public void addDropTargetListener(DropTargetListener dtl)
  throws TooManyListenersException {
    // Drop target listeners registered with this target will never be
    // notified, since all drag notifications are routed to the XEmbed
    // client. To avoid confusion we prohibit listeners registration
    // by throwing TooManyListenersException as if there is a listener
    // registered with this target already.
    throw new TooManyListenersException();
}
 
/**
 * actual processing on EventQueue Thread
 */

protected void processEnterMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    DropTarget dt   = c.getDropTarget();
    Point      hots = event.getPoint();

    local = getJVMLocalSourceTransferable();

    if (currentDTC != null) { // some wreckage from last time
        currentDTC.removeNotify();
        currentDTC = null;
    }

    if (c.isShowing() && dt != null && dt.isActive()) {
        currentDT  = dt;
        currentDTC = currentDT.getDropTargetContext();

        currentDTC.addNotify(this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
源代码4 项目: TencentKona-8   文件: SunDropTargetContextPeer.java
/**
 * actual processing on EventQueue Thread
 */

protected void processEnterMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    DropTarget dt   = c.getDropTarget();
    Point      hots = event.getPoint();

    local = getJVMLocalSourceTransferable();

    if (currentDTC != null) { // some wreckage from last time
        currentDTC.removeNotify();
        currentDTC = null;
    }

    if (c.isShowing() && dt != null && dt.isActive()) {
        currentDT  = dt;
        currentDTC = currentDT.getDropTargetContext();

        currentDTC.addNotify(this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
源代码5 项目: TencentKona-8   文件: XEmbedCanvasPeer.java
public void addDropTargetListener(DropTargetListener dtl)
  throws TooManyListenersException {
    // Drop target listeners registered with this target will never be
    // notified, since all drag notifications are routed to the XEmbed
    // client. To avoid confusion we prohibit listeners registration
    // by throwing TooManyListenersException as if there is a listener
    // registered with this target already.
    throw new TooManyListenersException();
}
 
源代码6 项目: jdk8u60   文件: SunDropTargetContextPeer.java
/**
 * actual processing on EventQueue Thread
 */

protected void processEnterMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    DropTarget dt   = c.getDropTarget();
    Point      hots = event.getPoint();

    local = getJVMLocalSourceTransferable();

    if (currentDTC != null) { // some wreckage from last time
        currentDTC.removeNotify();
        currentDTC = null;
    }

    if (c.isShowing() && dt != null && dt.isActive()) {
        currentDT  = dt;
        currentDTC = currentDT.getDropTargetContext();

        currentDTC.addNotify(this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
源代码7 项目: jdk8u60   文件: XEmbedCanvasPeer.java
public void addDropTargetListener(DropTargetListener dtl)
  throws TooManyListenersException {
    // Drop target listeners registered with this target will never be
    // notified, since all drag notifications are routed to the XEmbed
    // client. To avoid confusion we prohibit listeners registration
    // by throwing TooManyListenersException as if there is a listener
    // registered with this target already.
    throw new TooManyListenersException();
}
 
源代码8 项目: radiance   文件: AutoScrollingTreeDropTarget.java
AutoScrollingTreeDropTarget(JTree aTree, DropTargetListener listener) {
	super(aTree, DnDConstants.ACTION_COPY_OR_MOVE, listener);
	this.viewport = (JViewport) SwingUtilities.getAncestorOfClass(
			JViewport.class, aTree);
	this.scrollUnits = Math.max(aTree.getRowHeight(), 16);
	this.tree = aTree;
}
 
源代码9 项目: openjdk-jdk8u   文件: SunDropTargetContextPeer.java
/**
 * actual processing on EventQueue Thread
 */

protected void processEnterMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    DropTarget dt   = c.getDropTarget();
    Point      hots = event.getPoint();

    local = getJVMLocalSourceTransferable();

    if (currentDTC != null) { // some wreckage from last time
        currentDTC.removeNotify();
        currentDTC = null;
    }

    if (c.isShowing() && dt != null && dt.isActive()) {
        currentDT  = dt;
        currentDTC = currentDT.getDropTargetContext();

        currentDTC.addNotify(this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
源代码10 项目: openjdk-jdk8u   文件: XEmbedCanvasPeer.java
public void addDropTargetListener(DropTargetListener dtl)
  throws TooManyListenersException {
    // Drop target listeners registered with this target will never be
    // notified, since all drag notifications are routed to the XEmbed
    // client. To avoid confusion we prohibit listeners registration
    // by throwing TooManyListenersException as if there is a listener
    // registered with this target already.
    throw new TooManyListenersException();
}
 
/**
 * actual processing on EventQueue Thread
 */

protected void processEnterMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    DropTarget dt   = c.getDropTarget();
    Point      hots = event.getPoint();

    local = getJVMLocalSourceTransferable();

    if (currentDTC != null) { // some wreckage from last time
        currentDTC.removeNotify();
        currentDTC = null;
    }

    if (c.isShowing() && dt != null && dt.isActive()) {
        currentDT  = dt;
        currentDTC = currentDT.getDropTargetContext();

        currentDTC.addNotify(this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
源代码12 项目: openjdk-jdk8u-backup   文件: XEmbedCanvasPeer.java
public void addDropTargetListener(DropTargetListener dtl)
  throws TooManyListenersException {
    // Drop target listeners registered with this target will never be
    // notified, since all drag notifications are routed to the XEmbed
    // client. To avoid confusion we prohibit listeners registration
    // by throwing TooManyListenersException as if there is a listener
    // registered with this target already.
    throw new TooManyListenersException();
}
 
源代码13 项目: openjdk-jdk9   文件: XEmbedCanvasPeer.java
public void addDropTargetListener(DropTargetListener dtl)
  throws TooManyListenersException {
    // Drop target listeners registered with this target will never be
    // notified, since all drag notifications are routed to the XEmbed
    // client. To avoid confusion we prohibit listeners registration
    // by throwing TooManyListenersException as if there is a listener
    // registered with this target already.
    throw new TooManyListenersException();
}
 
源代码14 项目: jdk8u-jdk   文件: SunDropTargetContextPeer.java
/**
 * actual processing on EventQueue Thread
 */

protected void processEnterMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    DropTarget dt   = c.getDropTarget();
    Point      hots = event.getPoint();

    local = getJVMLocalSourceTransferable();

    if (currentDTC != null) { // some wreckage from last time
        currentDTC.removeNotify();
        currentDTC = null;
    }

    if (c.isShowing() && dt != null && dt.isActive()) {
        currentDT  = dt;
        currentDTC = currentDT.getDropTargetContext();

        currentDTC.addNotify(this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
源代码15 项目: jdk8u-jdk   文件: XEmbedCanvasPeer.java
public void addDropTargetListener(DropTargetListener dtl)
  throws TooManyListenersException {
    // Drop target listeners registered with this target will never be
    // notified, since all drag notifications are routed to the XEmbed
    // client. To avoid confusion we prohibit listeners registration
    // by throwing TooManyListenersException as if there is a listener
    // registered with this target already.
    throw new TooManyListenersException();
}
 
源代码16 项目: hottub   文件: SunDropTargetContextPeer.java
/**
 * actual processing on EventQueue Thread
 */

protected void processEnterMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    DropTarget dt   = c.getDropTarget();
    Point      hots = event.getPoint();

    local = getJVMLocalSourceTransferable();

    if (currentDTC != null) { // some wreckage from last time
        currentDTC.removeNotify();
        currentDTC = null;
    }

    if (c.isShowing() && dt != null && dt.isActive()) {
        currentDT  = dt;
        currentDTC = currentDT.getDropTargetContext();

        currentDTC.addNotify(this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
源代码17 项目: hottub   文件: XEmbedCanvasPeer.java
public void addDropTargetListener(DropTargetListener dtl)
  throws TooManyListenersException {
    // Drop target listeners registered with this target will never be
    // notified, since all drag notifications are routed to the XEmbed
    // client. To avoid confusion we prohibit listeners registration
    // by throwing TooManyListenersException as if there is a listener
    // registered with this target already.
    throw new TooManyListenersException();
}
 
/**
 * actual processing on EventQueue Thread
 */

protected void processEnterMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    DropTarget dt   = c.getDropTarget();
    Point      hots = event.getPoint();

    local = getJVMLocalSourceTransferable();

    if (currentDTC != null) { // some wreckage from last time
        currentDTC.removeNotify();
        currentDTC = null;
    }

    if (c.isShowing() && dt != null && dt.isActive()) {
        currentDT  = dt;
        currentDTC = currentDT.getDropTargetContext();

        currentDTC.addNotify(this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
源代码19 项目: openjdk-8-source   文件: XEmbedCanvasPeer.java
public void addDropTargetListener(DropTargetListener dtl)
  throws TooManyListenersException {
    // Drop target listeners registered with this target will never be
    // notified, since all drag notifications are routed to the XEmbed
    // client. To avoid confusion we prohibit listeners registration
    // by throwing TooManyListenersException as if there is a listener
    // registered with this target already.
    throw new TooManyListenersException();
}
 
源代码20 项目: openjdk-8   文件: SunDropTargetContextPeer.java
/**
 * actual processing on EventQueue Thread
 */

protected void processEnterMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    DropTarget dt   = c.getDropTarget();
    Point      hots = event.getPoint();

    local = getJVMLocalSourceTransferable();

    if (currentDTC != null) { // some wreckage from last time
        currentDTC.removeNotify();
        currentDTC = null;
    }

    if (c.isShowing() && dt != null && dt.isActive()) {
        currentDT  = dt;
        currentDTC = currentDT.getDropTargetContext();

        currentDTC.addNotify(this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
源代码21 项目: openjdk-8   文件: XEmbedCanvasPeer.java
public void addDropTargetListener(DropTargetListener dtl)
  throws TooManyListenersException {
    // Drop target listeners registered with this target will never be
    // notified, since all drag notifications are routed to the XEmbed
    // client. To avoid confusion we prohibit listeners registration
    // by throwing TooManyListenersException as if there is a listener
    // registered with this target already.
    throw new TooManyListenersException();
}
 
源代码22 项目: jdk8u_jdk   文件: SunDropTargetContextPeer.java
/**
 * actual processing on EventQueue Thread
 */

protected void processEnterMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    DropTarget dt   = c.getDropTarget();
    Point      hots = event.getPoint();

    local = getJVMLocalSourceTransferable();

    if (currentDTC != null) { // some wreckage from last time
        currentDTC.removeNotify();
        currentDTC = null;
    }

    if (c.isShowing() && dt != null && dt.isActive()) {
        currentDT  = dt;
        currentDTC = currentDT.getDropTargetContext();

        currentDTC.addNotify(this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
源代码23 项目: jdk8u_jdk   文件: XEmbedCanvasPeer.java
public void addDropTargetListener(DropTargetListener dtl)
  throws TooManyListenersException {
    // Drop target listeners registered with this target will never be
    // notified, since all drag notifications are routed to the XEmbed
    // client. To avoid confusion we prohibit listeners registration
    // by throwing TooManyListenersException as if there is a listener
    // registered with this target already.
    throw new TooManyListenersException();
}
 
public ProcessRendererDropTarget(final ProcessRendererView view, final DropTargetListener dropTargetListener) {
	super(view, TransferHandler.COPY_OR_MOVE | TransferHandler.LINK, null);
	this.view = view;
	try {
		super.addDropTargetListener(dropTargetListener);
	} catch (TooManyListenersException tmle) {
	}
}
 
@Override
public void addDropTargetListener(final DropTargetListener dtl) throws TooManyListenersException {
	if (dropTragetListenerList == null) {
		dropTragetListenerList = new EventListenerList();
	}
	dropTragetListenerList.add(DropTargetListener.class, dtl);
}
 
@Override
public void dragEnter(final DropTargetDragEvent e) {
	super.dragEnter(e);
	if (dropTragetListenerList != null) {
		Object[] listeners = dropTragetListenerList.getListenerList();
		for (int i = listeners.length - 2; i >= 0; i -= 2) {
			if (listeners[i] == DropTargetListener.class) {
				((DropTargetListener) listeners[i + 1]).dragEnter(e);
			}
		}
	}
}
 
@Override
public void dragOver(final DropTargetDragEvent e) {
	super.dragOver(e);
	if (dropTragetListenerList != null) {
		Object[] listeners = dropTragetListenerList.getListenerList();
		for (int i = listeners.length - 2; i >= 0; i -= 2) {
			if (listeners[i] == DropTargetListener.class) {
				((DropTargetListener) listeners[i + 1]).dragOver(e);
			}
		}
	}
}
 
@Override
public void dragExit(final DropTargetEvent e) {
	super.dragExit(e);
	view.getModel().setImportDragged(false);
	view.getModel().fireMiscChanged();
	if (dropTragetListenerList != null) {
		Object[] listeners = dropTragetListenerList.getListenerList();
		for (int i = listeners.length - 2; i >= 0; i -= 2) {
			if (listeners[i] == DropTargetListener.class) {
				((DropTargetListener) listeners[i + 1]).dragExit(e);
			}
		}
	}
}
 
@Override
public void drop(final DropTargetDropEvent e) {
	super.drop(e);
	view.getModel().setImportDragged(false);
	view.getModel().fireMiscChanged();
	if (dropTragetListenerList != null) {
		for (DropTargetListener listener : dropTragetListenerList.getListeners(DropTargetListener.class)) {
			listener.drop(e);
		}
	}
}
 
@Override
public void dropActionChanged(final DropTargetDragEvent e) {
	super.dropActionChanged(e);
	if (dropTragetListenerList != null) {
		for (DropTargetListener listener : dropTragetListenerList.getListeners(DropTargetListener.class)) {
			listener.dropActionChanged(e);
		}
	}
}
 
 类所在包
 同包方法