本文整理汇总了Java中java.awt.dnd.DnDConstants.ACTION_NONE属性的典型用法代码示例。如果您正苦于以下问题:Java DnDConstants.ACTION_NONE属性的具体用法?Java DnDConstants.ACTION_NONE怎么用?Java DnDConstants.ACTION_NONE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.awt.dnd.DnDConstants
的用法示例。
在下文中一共展示了DnDConstants.ACTION_NONE属性的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mouseDragged
/**
* Invoked when a mouse button is pressed on a component.
*/
public void mouseDragged(MouseEvent e) {
if (!events.isEmpty()) { // gesture pending
int dop = mapDragOperationFromModifiers(e);
if (dop == DnDConstants.ACTION_NONE) {
return;
}
MouseEvent trigger = (MouseEvent)events.get(0);
Point origin = trigger.getPoint();
Point current = e.getPoint();
int dx = Math.abs(origin.x - current.x);
int dy = Math.abs(origin.y - current.y);
if (dx > motionThreshold || dy > motionThreshold) {
fireDragGestureRecognized(dop, ((MouseEvent)getTriggerEvent()).getPoint());
} else
appendEvent(e);
}
}
示例2: mouseDragged
/**
* Invoked when a mouse button is pressed on a component.
*/
@Override
public void mouseDragged(MouseEvent e) {
if (!events.isEmpty()) { // gesture pending
int dop = mapDragOperationFromModifiers(e);
if (dop == DnDConstants.ACTION_NONE) {
return;
}
MouseEvent trigger = (MouseEvent)events.get(0);
Point origin = trigger.getPoint();
Point current = e.getPoint();
int dx = Math.abs(origin.x - current.x);
int dy = Math.abs(origin.y - current.y);
if (dx > motionThreshold || dy > motionThreshold) {
fireDragGestureRecognized(dop, ((MouseEvent)getTriggerEvent()).getPoint());
} else
appendEvent(e);
}
}
示例3: processXdndStatus
private boolean processXdndStatus(XClientMessageEvent xclient) {
int action = DnDConstants.ACTION_NONE;
/* Ignore XDnD messages from all other windows. */
if (xclient.get_data(0) != getTargetWindow()) {
return true;
}
if ((xclient.get_data(1) & XDnDConstants.XDND_ACCEPT_DROP_FLAG) != 0) {
/* This feature is new in XDnD version 2, but we can use it as XDnD
compliance only requires supporting version 3 and up. */
action = XDnDConstants.getJavaActionForXDnDAction(xclient.get_data(4));
}
getProtocolListener().handleDragReply(action);
return true;
}
示例4: processEnterMessage
/**
* 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: acceptDrag
/**
* acceptDrag
*/
public synchronized void acceptDrag(int dragOperation) {
if (currentDT == null) {
throw new InvalidDnDOperationException("No Drag pending");
}
currentDA = mapOperation(dragOperation);
if (currentDA != DnDConstants.ACTION_NONE) {
dragRejected = false;
}
}
示例6: mouseExited
/**
* Invoked when the mouse exits a component.
*/
@Override
public void mouseExited(MouseEvent e) {
if (!events.isEmpty()) { // gesture pending
int dragAction = mapDragOperationFromModifiers(e);
if (dragAction == DnDConstants.ACTION_NONE) {
events.clear();
}
}
}
示例7: mouseExited
/**
* Invoked when the mouse exits a component.
*/
public void mouseExited(MouseEvent e) {
if (!events.isEmpty()) { // gesture pending
int dragAction = mapDragOperationFromModifiers(e);
if (dragAction == DnDConstants.ACTION_NONE) {
events.clear();
}
}
}
示例8: convertModifiersToDropAction
public static int convertModifiersToDropAction(final int modifiers,
final int supportedActions) {
int dropAction = DnDConstants.ACTION_NONE;
/*
* Fix for 4285634.
* Calculate the drop action to match Motif DnD behavior.
* If the user selects an operation (by pressing a modifier key),
* return the selected operation or ACTION_NONE if the selected
* operation is not supported by the drag source.
* If the user doesn't select an operation search the set of operations
* supported by the drag source for ACTION_MOVE, then for
* ACTION_COPY, then for ACTION_LINK and return the first operation
* found.
*/
switch (modifiers & (InputEvent.SHIFT_DOWN_MASK |
InputEvent.CTRL_DOWN_MASK)) {
case InputEvent.SHIFT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK:
dropAction = DnDConstants.ACTION_LINK; break;
case InputEvent.CTRL_DOWN_MASK:
dropAction = DnDConstants.ACTION_COPY; break;
case InputEvent.SHIFT_DOWN_MASK:
dropAction = DnDConstants.ACTION_MOVE; break;
default:
if ((supportedActions & DnDConstants.ACTION_MOVE) != 0) {
dropAction = DnDConstants.ACTION_MOVE;
} else if ((supportedActions & DnDConstants.ACTION_COPY) != 0) {
dropAction = DnDConstants.ACTION_COPY;
} else if ((supportedActions & DnDConstants.ACTION_LINK) != 0) {
dropAction = DnDConstants.ACTION_LINK;
}
}
return dropAction & supportedActions;
}
示例9: mousePressed
/**
* Invoked when a mouse button has been pressed on a component.
*/
public void mousePressed(MouseEvent e) {
events.clear();
if (mapDragOperationFromModifiers(e) != DnDConstants.ACTION_NONE) {
try {
motionThreshold = DragSource.getDragThreshold();
} catch (Exception exc) {
motionThreshold = 5;
}
appendEvent(e);
}
}
示例10: cleanup
/**
* Reset the state of the object.
*/
public void cleanup() {
// Clear the reference to this protocol.
XDropTargetEventProcessor.reset();
if (targetXWindow != null) {
notifyProtocolListener(targetXWindow, 0, 0,
DnDConstants.ACTION_NONE, null,
MouseEvent.MOUSE_EXITED);
}
if (sourceWindow != 0) {
XToolkit.awtLock();
try {
XErrorHandlerUtil.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
XlibWrapper.XSelectInput(XToolkit.getDisplay(), sourceWindow,
sourceWindowMask);
XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
} finally {
XToolkit.awtUnlock();
}
}
sourceWindow = 0;
sourceWindowMask = 0;
sourceProtocolVersion = 0;
sourceActions = DnDConstants.ACTION_NONE;
sourceFormats = null;
trackSourceActions = false;
userAction = DnDConstants.ACTION_NONE;
sourceX = 0;
sourceY = 0;
targetXWindow = null;
}
示例11: getJavaActionsForMotifActions
public static int getJavaActionsForMotifActions(int motifActions) {
int javaActions = DnDConstants.ACTION_NONE;
if ((motifActions & MOTIF_DND_MOVE) != 0) {
javaActions |= DnDConstants.ACTION_MOVE;
}
if ((motifActions & MOTIF_DND_COPY) != 0) {
javaActions |= DnDConstants.ACTION_COPY;
}
if ((motifActions & MOTIF_DND_LINK) != 0) {
javaActions |= DnDConstants.ACTION_LINK;
}
return javaActions;
}
示例12: processExitMessage
/**
*
*/
protected void processExitMessage(SunDropTargetEvent event) {
Component c = (Component)event.getSource();
DropTarget dt = c.getDropTarget();
DropTargetContext dtc = null;
if (dt == null) {
currentDT = null;
currentT = null;
if (currentDTC != null) {
currentDTC.removeNotify();
}
currentDTC = null;
return;
}
if (dt != currentDT) {
if (currentDTC != null) {
currentDTC.removeNotify();
}
currentDT = dt;
currentDTC = dt.getDropTargetContext();
currentDTC.addNotify(this);
}
dtc = currentDTC;
if (dt.isActive()) try {
((DropTargetListener)dt).dragExit(new DropTargetEvent(dtc));
} catch (Exception e) {
e.printStackTrace();
} finally {
currentA = DnDConstants.ACTION_NONE;
currentSA = DnDConstants.ACTION_NONE;
currentDA = DnDConstants.ACTION_NONE;
currentDT = null;
currentT = null;
currentDTC.removeNotify();
currentDTC = null;
local = null;
dragRejected = false;
}
}
示例13: sendResponse
public boolean sendResponse(long ctxt, int eventID, int action) {
XClientMessageEvent xclient = new XClientMessageEvent(ctxt);
if (xclient.get_message_type() !=
XDnDConstants.XA_XdndPosition.getAtom()) {
return false;
}
if (eventID == MouseEvent.MOUSE_EXITED) {
action = DnDConstants.ACTION_NONE;
}
XClientMessageEvent msg = new XClientMessageEvent();
try {
msg.set_type((int)XConstants.ClientMessage);
msg.set_window(xclient.get_data(0));
msg.set_format(32);
msg.set_message_type(XDnDConstants.XA_XdndStatus.getAtom());
/* target window */
msg.set_data(0, xclient.get_window());
/* flags */
long flags = 0;
if (action != DnDConstants.ACTION_NONE) {
flags |= XDnDConstants.XDND_ACCEPT_DROP_FLAG;
}
msg.set_data(1, flags);
/* specify an empty rectangle */
msg.set_data(2, 0); /* x, y */
msg.set_data(3, 0); /* w, h */
/* action accepted by the target */
msg.set_data(4, XDnDConstants.getXDnDActionForJavaAction(action));
XToolkit.awtLock();
try {
XlibWrapper.XSendEvent(XToolkit.getDisplay(),
xclient.get_data(0),
false, XConstants.NoEventMask,
msg.pData);
} finally {
XToolkit.awtUnlock();
}
} finally {
msg.dispose();
}
return true;
}
示例14: WMouseDragGestureRecognizer
/**
* construct a new WMouseDragGestureRecognizer
*
* @param ds The DragSource for the Component c
* @param c The Component to observe
*/
protected WMouseDragGestureRecognizer(DragSource ds, Component c) {
this(ds, c, DnDConstants.ACTION_NONE);
}