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


Java MouseEvent.CTRL_DOWN_MASK属性代码示例

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


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

示例1: process

private boolean process (Widget widget, Point localLocation, int modifiers) {
    boolean ctrl = (modifiers & MouseEvent.CTRL_DOWN_MASK) != 0;
    boolean shift = (modifiers & MouseEvent.SHIFT_DOWN_MASK) != 0;
    ContiguousSelectEvent.SelectionType type = ctrl
            ? (shift ? ContiguousSelectEvent.SelectionType.ADDITIVE_CONTIGUOUS : ContiguousSelectEvent.SelectionType.ADDITIVE_NON_CONTIGUOUS)
            : (shift ? ContiguousSelectEvent.SelectionType.REPLACE_CONTIGUOUS : ContiguousSelectEvent.SelectionType.REPLACE_NON_CONTIGUOUS);
    ContiguousSelectEvent providerEvent = ContiguousSelectEvent.create (previousWidget, previousLocalLocation, widget, localLocation, type);
    if (provider.isSelectionAllowed (providerEvent)) {
        provider.select(providerEvent);
        if (! shift) {
            previousWidget = widget;
            previousLocalLocation = localLocation;
        }
        return true;
    }
    return false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:ContiguousSelectAction.java

示例2: mouseMoved

@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,代码行数:19,代码来源:DefaultMapController.java

示例3: mousePressed

public State mousePressed (Widget widget, WidgetMouseEvent event) {
    if (isLocked()) {
        return State.createLocked(widget, this);
    }
    
    Point localLocation = event.getPoint();
    
    if (event.getButton() == MouseEvent.BUTTON1 || event.getButton() == MouseEvent.BUTTON2) {
        invertSelection = (event.getModifiersEx() & MouseEvent.CTRL_DOWN_MASK) != 0;
        
        if (provider.isSelectionAllowed(widget, localLocation, invertSelection)) {
            aiming = provider.isAimingAllowed(widget, localLocation, invertSelection);
            if (aiming) {
                updateState(widget, localLocation);
                return State.createLocked(widget, this);
            } else {
                provider.select(widget, localLocation, invertSelection);
                return State.CHAIN_ONLY;
            }
        }
    } else if (trapRightClick && event.getButton() == MouseEvent.BUTTON3) {
        provider.select(widget, localLocation, false);
        return State.CHAIN_ONLY;
    }
    
    return State.REJECTED;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:SelectAction.java

示例4: canDrag

private boolean canDrag(MouseEvent e) {
    return (e.getModifiersEx() & (MouseEvent.ALT_DOWN_MASK |
                                  MouseEvent.ALT_GRAPH_DOWN_MASK |
                                  MouseEvent.CTRL_DOWN_MASK |
                                  MouseEvent.META_DOWN_MASK |
                                  MouseEvent.SHIFT_DOWN_MASK)) == 0;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:WatchAnnotationProvider.java

示例5: mousePressed

@Override
public State mousePressed(Widget widget, WidgetMouseEvent event) {
    if (event.getClickCount() >= 2 && (event.getButton() == MouseEvent.BUTTON1 || event.getButton() == MouseEvent.BUTTON2)) {
        boolean invert = (event.getModifiersEx() & MouseEvent.CTRL_DOWN_MASK) != 0;
        Point point = event.getPoint();
        if (provider.isSelectionAllowed(widget, point, invert)) {
            provider.select(widget, point, invert);
            return State.CHAIN_ONLY;
        }
    }
    return State.REJECTED;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:DoubleClickSelectAction.java


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