当前位置: 首页>>代码示例>>Java>>正文


Java MouseEvent.getModifiersEx方法代码示例

本文整理汇总了Java中java.awt.event.MouseEvent.getModifiersEx方法的典型用法代码示例。如果您正苦于以下问题:Java MouseEvent.getModifiersEx方法的具体用法?Java MouseEvent.getModifiersEx怎么用?Java MouseEvent.getModifiersEx使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.event.MouseEvent的用法示例。


在下文中一共展示了MouseEvent.getModifiersEx方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: mapDragOperationFromModifiers

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
/**
 * determine the drop action from the event
 */

protected int mapDragOperationFromModifiers(MouseEvent e) {
    int mods = e.getModifiersEx();
    int btns = mods & ButtonMask;

    // Prohibit multi-button drags.
    if (!(btns == InputEvent.BUTTON1_DOWN_MASK ||
          btns == InputEvent.BUTTON2_DOWN_MASK ||
          btns == InputEvent.BUTTON3_DOWN_MASK)) {
        return DnDConstants.ACTION_NONE;
    }

    return
        SunDragSourceContextPeer.convertModifiersToDropAction(mods,
                                                              getSourceActions());
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:WMouseDragGestureRecognizer.java

示例2: mouseMoved

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseMoved(MouseEvent e) {
    // Mac OSX simulates with  ctrl + mouse 1  the second mouse button hence no dragging events get fired.
    //
    if (isPlatformOsx()) {
        if (!movementEnabled || !isMoving)
            return;
        // Is only the selected mouse button pressed?
        if (e.getModifiersEx() == MouseEvent.CTRL_DOWN_MASK) {
            Point p = e.getPoint();
            if (lastDragPoint != null) {
                int diffx = lastDragPoint.x - p.x;
                int diffy = lastDragPoint.y - p.y;
                map.moveMap(diffx, diffy);
            }
            lastDragPoint = p;
        }
    }
}
 
开发者ID:berniejenny,项目名称:MapAnalyst,代码行数:20,代码来源:DefaultMapController.java

示例3: mapDragOperationFromModifiers

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
/**
 * determine the drop action from the event
 */

protected int mapDragOperationFromModifiers(MouseEvent e) {
    int mods = e.getModifiersEx();
    int btns = mods & ButtonMask;

    // Do not allow right mouse button drag since Motif DnD does not
    // terminate drag operation on right mouse button release.
    if (!(btns == InputEvent.BUTTON1_DOWN_MASK ||
          btns == InputEvent.BUTTON2_DOWN_MASK)) {
        return DnDConstants.ACTION_NONE;
    }

    return
        SunDragSourceContextPeer.convertModifiersToDropAction(mods,
                                                              getSourceActions());
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:20,代码来源:XMouseDragGestureRecognizer.java

示例4: isRightMouseButton

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
static boolean isRightMouseButton(MouseEvent me) {
    int numButtons = ((Integer)getDefaultToolkit().getDesktopProperty("awt.mouse.numButtons")).intValue();
    switch (me.getID()) {
      case MouseEvent.MOUSE_PRESSED:
      case MouseEvent.MOUSE_RELEASED:
          return ((numButtons == 2 && me.getButton() == MouseEvent.BUTTON2) ||
                   (numButtons > 2 && me.getButton() == MouseEvent.BUTTON3));
      case MouseEvent.MOUSE_ENTERED:
      case MouseEvent.MOUSE_EXITED:
      case MouseEvent.MOUSE_CLICKED:
      case MouseEvent.MOUSE_DRAGGED:
          return ((numButtons == 2 && (me.getModifiersEx() & InputEvent.BUTTON2_DOWN_MASK) != 0) ||
                  (numButtons > 2 && (me.getModifiersEx() & InputEvent.BUTTON3_DOWN_MASK) != 0));
    }
    return false;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:17,代码来源:XToolkit.java

示例5: updateMode

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
private ModificationStatus updateMode(MouseEvent e) {
    boolean leftDown = (e.getModifiersEx() & InputEvent.BUTTON1_DOWN_MASK) == InputEvent.BUTTON1_DOWN_MASK;
    boolean rightDown = (e.getModifiersEx() & InputEvent.BUTTON3_DOWN_MASK) == InputEvent.BUTTON3_DOWN_MASK;

    if (leftDown && rightDown) {
        operationMode = ModificationStatus.MOVE_CENTER;
    } else if (leftDown && !rightDown) {
        operationMode = ModificationStatus.MOVE_AHEAD;
    } else if (!leftDown && rightDown) {
        operationMode = ModificationStatus.ROTATE_EYE;
    } else {
        operationMode = ModificationStatus.NONE;
    }
    System.out.println("ModificationMode: " + operationMode);
    return operationMode;
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:17,代码来源:MapController.java

示例6: mouseDragged

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
/**
 * Pass mouse events into the event queue.
 *
 * @param mouse mouse event received
 */
public void mouseDragged(final MouseEvent mouse) {
    int modifiers = mouse.getModifiersEx();
    boolean eventMouse1 = false;
    boolean eventMouse2 = false;
    boolean eventMouse3 = false;
    if ((modifiers & MouseEvent.BUTTON1_DOWN_MASK) != 0) {
        eventMouse1 = true;
    }
    if ((modifiers & MouseEvent.BUTTON2_DOWN_MASK) != 0) {
        eventMouse2 = true;
    }
    if ((modifiers & MouseEvent.BUTTON3_DOWN_MASK) != 0) {
        eventMouse3 = true;
    }
    mouse1 = eventMouse1;
    mouse2 = eventMouse2;
    mouse3 = eventMouse3;
    int x = screen.textColumn(mouse.getX());
    int y = screen.textRow(mouse.getY());

    TMouseEvent mouseEvent = new TMouseEvent(TMouseEvent.Type.MOUSE_MOTION,
        x, y, x, y, mouse1, mouse2, mouse3, false, false);

    synchronized (eventQueue) {
        eventQueue.add(mouseEvent);
    }
    synchronized (listener) {
        listener.notifyAll();
    }
}
 
开发者ID:klamonte,项目名称:jermit,代码行数:36,代码来源:SwingTerminal.java

示例7: mousePressed

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mousePressed(Canvas canvas, MouseEvent e) {
	int mx = e.getX();
	int my = e.getY();
	lastMouseX = mx;
	lastMouseY = my;
	int mods = e.getModifiersEx();
	if ((mods & InputEvent.CTRL_DOWN_MASK) == 0) {
		mx = canvas.snapX(mx);
		my = canvas.snapY(my);
	}

	if (active && e.getClickCount() > 1) {
		CanvasObject add = commit(canvas);
		canvas.toolGestureComplete(this, add);
		return;
	}

	Location loc = Location.create(mx, my);
	ArrayList<Location> locs = locations;
	if (!active) {
		locs.clear();
		locs.add(loc);
	}
	locs.add(loc);

	mouseDown = true;
	active = canvas.getModel() != null;
	repaintArea(canvas);
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:31,代码来源:PolyTool.java

示例8: mapDragOperationFromModifiers

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
protected int mapDragOperationFromModifiers(MouseEvent e) {
    int mods = e.getModifiersEx();
    
    if ((mods & InputEvent.BUTTON1_DOWN_MASK) == 0) {
        return TransferHandler.NONE;
    }
    
    return TransferHandler.COPY_OR_MOVE;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:BaseCaret.java

示例9: mousePressed

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mousePressed(MouseEvent e) {
    if (e.getButton() == movementMouseButton || (isPlatformOsx() && e.getModifiersEx() == MAC_MOUSE_BUTTON3_MASK)) {
        lastDragPoint = null;
        isMoving = true;
    }
}
 
开发者ID:berniejenny,项目名称:MapAnalyst,代码行数:8,代码来源:DefaultMapController.java

示例10: isLeftMouseButton

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
static boolean isLeftMouseButton(MouseEvent me) {
    switch (me.getID()) {
      case MouseEvent.MOUSE_PRESSED:
      case MouseEvent.MOUSE_RELEASED:
          return (me.getButton() == MouseEvent.BUTTON1);
      case MouseEvent.MOUSE_ENTERED:
      case MouseEvent.MOUSE_EXITED:
      case MouseEvent.MOUSE_CLICKED:
      case MouseEvent.MOUSE_DRAGGED:
          return ((me.getModifiersEx() & InputEvent.BUTTON1_DOWN_MASK) != 0);
    }
    return false;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:14,代码来源:XToolkit.java

示例11: test

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
private static void test(final Frame frame, final MouseEvent me) {
    MouseEvent newme = SwingUtilities.convertMouseEvent(frame, me, frame);
    if (me.getModifiersEx() != newme.getModifiersEx()
            || me.getModifiers() != newme.getModifiers()) {
        fail(me, newme);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:8,代码来源:bug7170657.java

示例12: clickedAt

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
private void clickedAt(MouseEvent e) {
    if (!isEnabled()) return;

    if (!editable)
        return;

    int dx = DeviceImagePainter.getXSpacing(getWidth());
    int dy = DeviceImagePainter.getYSpacing(getHeight());
    int sx = DeviceImagePainter.getXSize(getWidth());
    int sy = DeviceImagePainter.getYSize(getHeight());

    int x = (e.getX() - dx) / (sx + dx);
    int y = (e.getY() - dy) / (sy + dy);

    boolean v = !deviceImage.getPixel(x, y);
    if ((e.getModifiersEx() & InputEvent.SHIFT_DOWN_MASK) != 0) {
        for (int i = 0; i < DeviceImage.MAX_Y; i++) {
            deviceImage.setPixel(x, i, v);
        }
    } else if ((e.getModifiersEx() & InputEvent.CTRL_DOWN_MASK) != 0) {
        for (int i = 0; i < DeviceImage.MAX_X; i++) {
            deviceImage.setPixel(i, y, v);
        }
    } else {
        deviceImage.setPixel(x, y, v);
    }

    fireStateChanged();
    repaint();
}
 
开发者ID:TheCaveCz,项目名称:letsmake-ledmatrix,代码行数:31,代码来源:ImageEditorPanel.java

示例13: isButton1

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
private boolean isButton1(MouseEvent e) {
	return (e.getModifiersEx() & InputEvent.BUTTON1_DOWN_MASK) != 0;
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:4,代码来源:CanvasListener.java

示例14: logMouseEvent

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
private static String logMouseEvent(MouseEvent evt) {
    return "x=" + evt.getX() + ", y=" + evt.getY() + ", clicks=" + evt.getClickCount() //NOI18N
        + ", component=" + s2s(evt.getComponent()) //NOI18N
        + ", source=" + s2s(evt.getSource()) + ", button=" + evt.getButton() + ", mods=" + evt.getModifiers() + ", modsEx=" + evt.getModifiersEx(); //NOI18N
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:6,代码来源:BaseCaret.java

示例15: isMiddleMouseButtonExt

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
private boolean isMiddleMouseButtonExt(MouseEvent evt) {
    return (evt.getButton() == MouseEvent.BUTTON2) &&
            (evt.getModifiersEx() & (InputEvent.CTRL_DOWN_MASK | InputEvent.META_DOWN_MASK | /* cannot be tested bcs of bug in JDK InputEvent.ALT_DOWN_MASK | */ InputEvent.ALT_GRAPH_DOWN_MASK)) == 0;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:EditorCaret.java


注:本文中的java.awt.event.MouseEvent.getModifiersEx方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。