Java Code Examples for sun.awt.AWTAccessor#getDragSourceContextAccessor()
The following examples show how to use
sun.awt.AWTAccessor#getDragSourceContextAccessor() .
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 check out the related API usage on the sidebar.
Example 1
Source File: DragSource.java From Bytecoder with Apache License 2.0 | 3 votes |
/** * Start a drag, given the {@code DragGestureEvent} * that initiated the drag, the initial * {@code Cursor} to use, * the {@code Image} to drag, * the offset of the {@code Image} origin * from the hotspot of the {@code Cursor} at * the instant of the trigger, * the {@code Transferable} subject data * of the drag, the {@code DragSourceListener}, * and the {@code FlavorMap}. * * @param trigger the {@code DragGestureEvent} 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} origin from the hotspot * of the {@code Cursor} at the instant of the trigger * @param transferable the subject data of the drag * @param dsl the {@code DragSourceListener} * @param flavorMap the {@code FlavorMap} to use, or {@code null} * * @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; DragSourceContext dsc = createDragSourceContext(trigger, dragCursor, dragImage, imageOffset, transferable, dsl); if (dsc == null) { throw new InvalidDnDOperationException(); } DragSourceContextAccessor acc = AWTAccessor.getDragSourceContextAccessor(); acc.getPeer(dsc).startDrag(dsc, dsc.getCursor(), dragImage, imageOffset); // may throw } catch (RuntimeException e) { SunDragSourceContextPeer.setDragDropInProgress(false); throw e; } }
Example 2
Source File: DragSource.java From openjdk-jdk9 with GNU General Public License v2.0 | 3 votes |
/** * Start a drag, given the {@code DragGestureEvent} * that initiated the drag, the initial * {@code Cursor} to use, * the {@code Image} to drag, * the offset of the {@code Image} origin * from the hotspot of the {@code Cursor} at * the instant of the trigger, * the {@code Transferable} subject data * of the drag, the {@code DragSourceListener}, * and the {@code FlavorMap}. * * @param trigger the {@code DragGestureEvent} 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} origin from the hotspot * of the {@code Cursor} at the instant of the trigger * @param transferable the subject data of the drag * @param dsl the {@code DragSourceListener} * @param flavorMap the {@code FlavorMap} to use, or {@code null} * * @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; DragSourceContext dsc = createDragSourceContext(trigger, dragCursor, dragImage, imageOffset, transferable, dsl); if (dsc == null) { throw new InvalidDnDOperationException(); } DragSourceContextAccessor acc = AWTAccessor.getDragSourceContextAccessor(); acc.getPeer(dsc).startDrag(dsc, dsc.getCursor(), dragImage, imageOffset); // may throw } catch (RuntimeException e) { SunDragSourceContextPeer.setDragDropInProgress(false); throw e; } }