Java Code Examples for java.awt.event.MouseEvent.CTRL_DOWN_MASK

The following are Jave code examples for showing how to use CTRL_DOWN_MASK of the java.awt.event.MouseEvent class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: incubator-netbeans   File: ContiguousSelectAction.java   View Source Code Vote up 6 votes
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;
}
 
Example 2
Project: MapAnalyst   File: DefaultMapController.java   View Source Code Vote up 6 votes
@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;
        }
    }
}
 
Example 3
Project: incubator-netbeans   File: SelectAction.java   View Source Code Vote up 5 votes
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;
}
 
Example 4
Project: incubator-netbeans   File: WatchAnnotationProvider.java   View Source Code Vote up 5 votes
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;
}
 
Example 5
Project: openjdk-jdk10   File: DoubleClickSelectAction.java   View Source Code Vote up 5 votes
@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;
}