/**
* Creates a new DropTarget given the {@code Component}
* to associate itself with, an {@code int} representing
* the default acceptable action(s) to
* support, a {@code DropTargetListener}
* to handle event processing, a {@code boolean} indicating
* if the {@code DropTarget} is currently accepting drops, and
* a {@code FlavorMap} to use (or null for the default {@code FlavorMap}).
* <P>
* The Component will receive drops only if it is enabled.
* @param c The {@code Component} with which this {@code DropTarget} is associated
* @param ops The default acceptable actions for this {@code DropTarget}
* @param dtl The {@code DropTargetListener} for this {@code DropTarget}
* @param act Is the {@code DropTarget} accepting drops.
* @param fm The {@code FlavorMap} to use, or null for the default {@code FlavorMap}
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true
* @see java.awt.GraphicsEnvironment#isHeadless
*/
public DropTarget(Component c, int ops, DropTargetListener dtl,
boolean act, FlavorMap fm)
throws HeadlessException
{
if (GraphicsEnvironment.isHeadless()) {
throw new HeadlessException();
}
component = c;
setDefaultActions(ops);
if (dtl != null) try {
addDropTargetListener(dtl);
} catch (TooManyListenersException tmle) {
// do nothing!
}
if (c != null) {
c.setDropTarget(this);
setActive(act);
}
if (fm != null) {
flavorMap = fm;
} else {
flavorMap = SystemFlavorMap.getDefaultFlavorMap();
}
}
DropTarget.java 文件源码
java
阅读 28
收藏 0
点赞 0
评论 0
项目:openjdk-jdk10
作者:
评论列表
文章目录