下面列出了怎么用java.awt.dnd.peer.DragSourceContextPeer的API类实例代码及写法,或者点击链接到github查看源代码。
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent());
if (f != null) {
return f.createDragSourceContextPeer(dge);
}
return XDragSourceContextPeer.createDragSourceContextPeer(dge);
}
/**
* Start a drag, given the <code>DragGestureEvent</code>
* that initiated the drag, the initial
* <code>Cursor</code> to use,
* the <code>Image</code> to drag,
* the offset of the <code>Image</code> origin
* from the hotspot of the <code>Cursor</code> at
* the instant of the trigger,
* the <code>Transferable</code> subject data
* of the drag, the <code>DragSourceListener</code>,
* and the <code>FlavorMap</code>.
* <P>
* @param trigger the <code>DragGestureEvent</code> that initiated the drag
* @param dragCursor the initial {@code Cursor} for this drag operation
* or {@code null} for the default cursor handling;
* see <a href="DragSourceContext.html#defaultCursor">DragSourceContext</a>
* for more details on the cursor handling mechanism during drag and drop
* @param dragImage the image to drag or {@code null}
* @param imageOffset the offset of the <code>Image</code> origin from the hotspot
* of the <code>Cursor</code> at the instant of the trigger
* @param transferable the subject data of the drag
* @param dsl the <code>DragSourceListener</code>
* @param flavorMap the <code>FlavorMap</code> to use, or <code>null</code>
* <P>
* @throws java.awt.dnd.InvalidDnDOperationException
* if the Drag and Drop
* system is unable to initiate a drag operation, or if the user
* attempts to start a drag while an existing drag operation
* is still executing
*/
public void startDrag(DragGestureEvent trigger,
Cursor dragCursor,
Image dragImage,
Point imageOffset,
Transferable transferable,
DragSourceListener dsl,
FlavorMap flavorMap) throws InvalidDnDOperationException {
SunDragSourceContextPeer.setDragDropInProgress(true);
try {
if (flavorMap != null) this.flavorMap = flavorMap;
DragSourceContextPeer dscp = Toolkit.getDefaultToolkit().createDragSourceContextPeer(trigger);
DragSourceContext dsc = createDragSourceContext(dscp,
trigger,
dragCursor,
dragImage,
imageOffset,
transferable,
dsl
);
if (dsc == null) {
throw new InvalidDnDOperationException();
}
dscp.startDrag(dsc, dsc.getCursor(), dragImage, imageOffset); // may throw
} catch (RuntimeException e) {
SunDragSourceContextPeer.setDragDropInProgress(false);
throw e;
}
}
@Override
public DragSourceContextPeer createDragSourceContextPeer(
DragGestureEvent dge) throws InvalidDnDOperationException {
final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent());
if (f != null) {
return f.createDragSourceContextPeer(dge);
}
return CDragSourceContextPeer.createDragSourceContextPeer(dge);
}
/**
* Start a drag, given the <code>DragGestureEvent</code>
* that initiated the drag, the initial
* <code>Cursor</code> to use,
* the <code>Image</code> to drag,
* the offset of the <code>Image</code> origin
* from the hotspot of the <code>Cursor</code> at
* the instant of the trigger,
* the <code>Transferable</code> subject data
* of the drag, the <code>DragSourceListener</code>,
* and the <code>FlavorMap</code>.
* <P>
* @param trigger the <code>DragGestureEvent</code> that initiated the drag
* @param dragCursor the initial {@code Cursor} for this drag operation
* or {@code null} for the default cursor handling;
* see <a href="DragSourceContext.html#defaultCursor">DragSourceContext</a>
* for more details on the cursor handling mechanism during drag and drop
* @param dragImage the image to drag or {@code null}
* @param imageOffset the offset of the <code>Image</code> origin from the hotspot
* of the <code>Cursor</code> at the instant of the trigger
* @param transferable the subject data of the drag
* @param dsl the <code>DragSourceListener</code>
* @param flavorMap the <code>FlavorMap</code> to use, or <code>null</code>
* <P>
* @throws java.awt.dnd.InvalidDnDOperationException
* if the Drag and Drop
* system is unable to initiate a drag operation, or if the user
* attempts to start a drag while an existing drag operation
* is still executing
*/
public void startDrag(DragGestureEvent trigger,
Cursor dragCursor,
Image dragImage,
Point imageOffset,
Transferable transferable,
DragSourceListener dsl,
FlavorMap flavorMap) throws InvalidDnDOperationException {
SunDragSourceContextPeer.setDragDropInProgress(true);
try {
if (flavorMap != null) this.flavorMap = flavorMap;
DragSourceContextPeer dscp = Toolkit.getDefaultToolkit().createDragSourceContextPeer(trigger);
DragSourceContext dsc = createDragSourceContext(dscp,
trigger,
dragCursor,
dragImage,
imageOffset,
transferable,
dsl
);
if (dsc == null) {
throw new InvalidDnDOperationException();
}
dscp.startDrag(dsc, dsc.getCursor(), dragImage, imageOffset); // may throw
} catch (RuntimeException e) {
SunDragSourceContextPeer.setDragDropInProgress(false);
throw e;
}
}
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent());
if (f != null) {
return f.createDragSourceContextPeer(dge);
}
return XDragSourceContextPeer.createDragSourceContextPeer(dge);
}
/**
* create the peer for a DragSourceContext
*/
@Override
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent());
if (f != null) {
return f.createDragSourceContextPeer(dge);
}
return WDragSourceContextPeer.createDragSourceContextPeer(dge);
}
/**
* create the peer for a DragSourceContext
*/
@Override
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent());
if (f != null) {
return f.createDragSourceContextPeer(dge);
}
return WDragSourceContextPeer.createDragSourceContextPeer(dge);
}
/**
* create the peer for a DragSourceContext
*/
@Override
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent());
if (f != null) {
return f.createDragSourceContextPeer(dge);
}
return WDragSourceContextPeer.createDragSourceContextPeer(dge);
}
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent());
if (f != null) {
return f.createDragSourceContextPeer(dge);
}
return XDragSourceContextPeer.createDragSourceContextPeer(dge);
}
/**
* Start a drag, given the <code>DragGestureEvent</code>
* that initiated the drag, the initial
* <code>Cursor</code> to use,
* the <code>Image</code> to drag,
* the offset of the <code>Image</code> origin
* from the hotspot of the <code>Cursor</code> at
* the instant of the trigger,
* the <code>Transferable</code> subject data
* of the drag, the <code>DragSourceListener</code>,
* and the <code>FlavorMap</code>.
* <P>
* @param trigger the <code>DragGestureEvent</code> that initiated the drag
* @param dragCursor the initial {@code Cursor} for this drag operation
* or {@code null} for the default cursor handling;
* see <a href="DragSourceContext.html#defaultCursor">DragSourceContext</a>
* for more details on the cursor handling mechanism during drag and drop
* @param dragImage the image to drag or {@code null}
* @param imageOffset the offset of the <code>Image</code> origin from the hotspot
* of the <code>Cursor</code> at the instant of the trigger
* @param transferable the subject data of the drag
* @param dsl the <code>DragSourceListener</code>
* @param flavorMap the <code>FlavorMap</code> to use, or <code>null</code>
* <P>
* @throws java.awt.dnd.InvalidDnDOperationException
* if the Drag and Drop
* system is unable to initiate a drag operation, or if the user
* attempts to start a drag while an existing drag operation
* is still executing
*/
public void startDrag(DragGestureEvent trigger,
Cursor dragCursor,
Image dragImage,
Point imageOffset,
Transferable transferable,
DragSourceListener dsl,
FlavorMap flavorMap) throws InvalidDnDOperationException {
SunDragSourceContextPeer.setDragDropInProgress(true);
try {
if (flavorMap != null) this.flavorMap = flavorMap;
DragSourceContextPeer dscp = Toolkit.getDefaultToolkit().createDragSourceContextPeer(trigger);
DragSourceContext dsc = createDragSourceContext(dscp,
trigger,
dragCursor,
dragImage,
imageOffset,
transferable,
dsl
);
if (dsc == null) {
throw new InvalidDnDOperationException();
}
dscp.startDrag(dsc, dsc.getCursor(), dragImage, imageOffset); // may throw
} catch (RuntimeException e) {
SunDragSourceContextPeer.setDragDropInProgress(false);
throw e;
}
}
@Override
public DragSourceContextPeer createDragSourceContextPeer(
DragGestureEvent dge) throws InvalidDnDOperationException {
final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent());
if (f != null) {
return f.createDragSourceContextPeer(dge);
}
return CDragSourceContextPeer.createDragSourceContextPeer(dge);
}
@Override
public DragSourceContextPeer createDragSourceContextPeer(
DragGestureEvent dge) throws InvalidDnDOperationException {
final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent());
if (f != null) {
return f.createDragSourceContextPeer(dge);
}
return CDragSourceContextPeer.createDragSourceContextPeer(dge);
}
/**
* Start a drag, given the <code>DragGestureEvent</code>
* that initiated the drag, the initial
* <code>Cursor</code> to use,
* the <code>Image</code> to drag,
* the offset of the <code>Image</code> origin
* from the hotspot of the <code>Cursor</code> at
* the instant of the trigger,
* the <code>Transferable</code> subject data
* of the drag, the <code>DragSourceListener</code>,
* and the <code>FlavorMap</code>.
* <P>
* @param trigger the <code>DragGestureEvent</code> that initiated the drag
* @param dragCursor the initial {@code Cursor} for this drag operation
* or {@code null} for the default cursor handling;
* see <a href="DragSourceContext.html#defaultCursor">DragSourceContext</a>
* for more details on the cursor handling mechanism during drag and drop
* @param dragImage the image to drag or {@code null}
* @param imageOffset the offset of the <code>Image</code> origin from the hotspot
* of the <code>Cursor</code> at the instant of the trigger
* @param transferable the subject data of the drag
* @param dsl the <code>DragSourceListener</code>
* @param flavorMap the <code>FlavorMap</code> to use, or <code>null</code>
* <P>
* @throws java.awt.dnd.InvalidDnDOperationException
* if the Drag and Drop
* system is unable to initiate a drag operation, or if the user
* attempts to start a drag while an existing drag operation
* is still executing
*/
public void startDrag(DragGestureEvent trigger,
Cursor dragCursor,
Image dragImage,
Point imageOffset,
Transferable transferable,
DragSourceListener dsl,
FlavorMap flavorMap) throws InvalidDnDOperationException {
SunDragSourceContextPeer.setDragDropInProgress(true);
try {
if (flavorMap != null) this.flavorMap = flavorMap;
DragSourceContextPeer dscp = Toolkit.getDefaultToolkit().createDragSourceContextPeer(trigger);
DragSourceContext dsc = createDragSourceContext(dscp,
trigger,
dragCursor,
dragImage,
imageOffset,
transferable,
dsl
);
if (dsc == null) {
throw new InvalidDnDOperationException();
}
dscp.startDrag(dsc, dsc.getCursor(), dragImage, imageOffset); // may throw
} catch (RuntimeException e) {
SunDragSourceContextPeer.setDragDropInProgress(false);
throw e;
}
}
@Override
public DragSourceContextPeer createDragSourceContextPeer(
DragGestureEvent dge) throws InvalidDnDOperationException {
final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent());
if (f != null) {
return f.createDragSourceContextPeer(dge);
}
return CDragSourceContextPeer.createDragSourceContextPeer(dge);
}
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent());
if (f != null) {
return f.createDragSourceContextPeer(dge);
}
return XDragSourceContextPeer.createDragSourceContextPeer(dge);
}
@Override
public DragSourceContextPeer createDragSourceContextPeer(
final DragGestureEvent dge) throws InvalidDnDOperationException {
return null;
}
public DragSourceContextPeer createDragSourceContextPeer(
DragGestureEvent dge)
throws InvalidDnDOperationException {
throw new InvalidDnDOperationException("Headless environment");
}
DragSourceContextPeer createDragSourceContextPeer(
DragGestureEvent dge)
throws InvalidDnDOperationException, HeadlessException;
public DragSourceContextPeer createDragSourceContextPeer(
DragGestureEvent dge)
throws InvalidDnDOperationException {
throw new InvalidDnDOperationException("Headless environment");
}
/**
* Create a drag source context peer for the lightweight frame.
*/
default public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException
{
return null;
}
/**
* Create a drag source context peer for the lightweight frame.
*/
default public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException
{
return null;
}
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
return content == null ? null : content.createDragSourceContextPeer(dge);
}
@Override
public DragSourceContextPeer createDragSourceContextPeer(
final DragGestureEvent dge) throws InvalidDnDOperationException {
return null;
}
@Override
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
return null;
}
public DragSourceContextPeer createDragSourceContextPeer(
DragGestureEvent dge)
throws InvalidDnDOperationException {
throw new InvalidDnDOperationException("Headless environment");
}
DragSourceContextPeer createDragSourceContextPeer(
DragGestureEvent dge)
throws InvalidDnDOperationException, HeadlessException;
public abstract DragSourceContextPeer createDragSourceContextPeer(
DragGestureEvent dge)
throws InvalidDnDOperationException;
public DragSourceContextPeer createDragSourceContextPeer(
DragGestureEvent dge)
throws InvalidDnDOperationException {
throw new InvalidDnDOperationException("Headless environment");
}
DragSourceContextPeer createDragSourceContextPeer(
DragGestureEvent dge)
throws InvalidDnDOperationException, HeadlessException;
public DragSourceContextPeer createDragSourceContextPeer(
DragGestureEvent dge)
throws InvalidDnDOperationException {
throw new InvalidDnDOperationException("Headless environment");
}