Module java.desktop
Package java.awt.dnd

Class DragSourceDropEvent

所有已实现的接口:
Serializable

public class DragSourceDropEvent extends DragSourceEvent
DragSourceDropEvent是通过DragSourceContextPeerDragSourceContext传递到DragSourceListenerdragDropEnd方法,注册了与该DragSourceContext及其关联的DragSourceDragSourceListener。当操作完成时,它包含足够的信息,以便操作发起者向最终用户提供适当的反馈。
自:
1.2
参见:
  • Constructor Details

    • DragSourceDropEvent

      public DragSourceDropEvent(DragSourceContext dsc, int action, boolean success)
      构造一个放置的DragSourceDropEvent,给定DragSourceContext,放置操作以及指示放置是否成功的boolean。此DragSourceDropEvent的坐标未指定,因此对于此事件,getLocation将返回null

      参数action应为表示单个操作的DnDConstants之一。此构造函数不会对无效的action抛出任何异常。

      参数:
      dsc - 与此DragSourceDropEvent关联的DragSourceContext
      action - 放置操作
      success - 指示放置是否成功的boolean
      抛出:
      IllegalArgumentException - 如果dscnull
      参见:
    • DragSourceDropEvent

      public DragSourceDropEvent(DragSourceContext dsc, int action, boolean success, int x, int y)
      构造一个放置的DragSourceDropEvent,给定DragSourceContext,放置操作,指示放置是否成功的boolean,以及坐标。

      参数action应为表示单个操作的DnDConstants之一。此构造函数不会对无效的action抛出任何异常。

      参数:
      dsc - 与此DragSourceDropEvent关联的DragSourceContext
      action - 放置操作
      success - 指示放置是否成功的boolean
      x - 光标位置的水平坐标
      y - 光标位置的垂直坐标
      抛出:
      IllegalArgumentException - 如果dscnull
      自:
      1.4
    • DragSourceDropEvent

      public DragSourceDropEvent(DragSourceContext dsc)
      构造一个不会导致放置的拖动的DragSourceDropEvent。此DragSourceDropEvent的坐标未指定,因此对于此事件,getLocation将返回null
      参数:
      dsc - DragSourceContext
      抛出:
      IllegalArgumentException - 如果dscnull
      参见:
  • Method Details

    • getDropSuccess

      public boolean getDropSuccess()
      该方法返回一个表示放置是否成功的boolean
      返回:
      如果放置目标接受了放置并成功执行了放置操作,则为true; 如果放置目标拒绝了放置或者放置目标接受了放置,但未能执行放置操作,则为false
    • getDropAction

      public int getDropAction()
      该方法返回一个表示目标在放置主题上执行的操作的int
      返回:
      如果放置目标接受了放置并目标放置操作受拖动源支持,则为放置目标在放置主题上执行的操作; 否则为DnDConstants.ACTION_NONE