當前位置: 首頁>>代碼示例>>Java>>正文


Java MouseEvent.BUTTON1_DOWN_MASK屬性代碼示例

本文整理匯總了Java中java.awt.event.MouseEvent.BUTTON1_DOWN_MASK屬性的典型用法代碼示例。如果您正苦於以下問題:Java MouseEvent.BUTTON1_DOWN_MASK屬性的具體用法?Java MouseEvent.BUTTON1_DOWN_MASK怎麽用?Java MouseEvent.BUTTON1_DOWN_MASK使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在java.awt.event.MouseEvent的用法示例。


在下文中一共展示了MouseEvent.BUTTON1_DOWN_MASK屬性的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: mouseEntered

/** Activates automatic slide in system */
@Override
public void mouseEntered(MouseEvent e) {
    if (!slideBar.isHoveringAllowed()) {
        // don't even try to trigger automatic sliding when focused slide is active
        return;
    }
    mouseInButton = (Component)e.getSource();
    curMouseLocX = e.getX();
    curMouseLocY = e.getY();
    pressingButton =false;
    // #54764 - start
    if ((e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) == MouseEvent.BUTTON1_DOWN_MASK) {
        pressingButton = true;
        return;
    }
    // #54764 - end
    autoSlideTrigger.activateAutoSlideInGesture();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:SlideGestureRecognizer.java

示例2: setMovementMouseButton

/**
 * Sets the mouse button that is used for moving the map. Possible values are:
 * <ul>
 * <li>{@link MouseEvent#BUTTON1} (left mouse button)</li>
 * <li>{@link MouseEvent#BUTTON2} (middle mouse button)</li>
 * <li>{@link MouseEvent#BUTTON3} (right mouse button)</li>
 * </ul>
 *
 * @param movementMouseButton the mouse button that is used for moving the map
 */
public void setMovementMouseButton(int movementMouseButton) {
    this.movementMouseButton = movementMouseButton;
    switch (movementMouseButton) {
        case MouseEvent.BUTTON1:
            movementMouseButtonMask = MouseEvent.BUTTON1_DOWN_MASK;
            break;
        case MouseEvent.BUTTON2:
            movementMouseButtonMask = MouseEvent.BUTTON2_DOWN_MASK;
            break;
        case MouseEvent.BUTTON3:
            movementMouseButtonMask = MouseEvent.BUTTON3_DOWN_MASK;
            break;
        default:
            throw new RuntimeException("Unsupported button");
    }
}
 
開發者ID:berniejenny,項目名稱:MapAnalyst,代碼行數:26,代碼來源:DefaultMapController.java

示例3: mouseDragged

/**
 * 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,代碼行數:35,代碼來源:SwingTerminal.java

示例4: mousePressed

/**
 * Pass mouse events into the event queue.
 *
 * @param mouse mouse event received
 */
public void mousePressed(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_DOWN,
        x, y, x, y, mouse1, mouse2, mouse3, false, false);

    synchronized (eventQueue) {
        eventQueue.add(mouseEvent);
    }
    synchronized (listener) {
        listener.notifyAll();
    }
}
 
開發者ID:klamonte,項目名稱:jermit,代碼行數:35,代碼來源:SwingTerminal.java

示例5: mouseReleased

/**
 * Pass mouse events into the event queue.
 *
 * @param mouse mouse event received
 */
public void mouseReleased(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;
    }
    if (mouse1) {
        mouse1 = false;
        eventMouse1 = true;
    }
    if (mouse2) {
        mouse2 = false;
        eventMouse2 = true;
    }
    if (mouse3) {
        mouse3 = false;
        eventMouse3 = true;
    }
    int x = screen.textColumn(mouse.getX());
    int y = screen.textRow(mouse.getY());

    TMouseEvent mouseEvent = new TMouseEvent(TMouseEvent.Type.MOUSE_UP,
        x, y, x, y, eventMouse1, eventMouse2, eventMouse3, false, false);

    synchronized (eventQueue) {
        eventQueue.add(mouseEvent);
    }
    synchronized (listener) {
        listener.notifyAll();
    }
}
 
開發者ID:klamonte,項目名稱:jermit,代碼行數:44,代碼來源:SwingTerminal.java

示例6: mouseWheelMoved

/**
 * Pass mouse events into the event queue.
 *
 * @param mouse mouse event received
 */
public void mouseWheelMoved(final MouseWheelEvent mouse) {
    int modifiers = mouse.getModifiersEx();
    boolean eventMouse1 = false;
    boolean eventMouse2 = false;
    boolean eventMouse3 = false;
    boolean mouseWheelUp = false;
    boolean mouseWheelDown = 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());
    if (mouse.getWheelRotation() > 0) {
        mouseWheelDown = true;
    }
    if (mouse.getWheelRotation() < 0) {
        mouseWheelUp = true;
    }

    TMouseEvent mouseEvent = new TMouseEvent(TMouseEvent.Type.MOUSE_DOWN,
        x, y, x, y, mouse1, mouse2, mouse3, mouseWheelUp, mouseWheelDown);

    synchronized (eventQueue) {
        eventQueue.add(mouseEvent);
    }
    synchronized (listener) {
        listener.notifyAll();
    }
}
 
開發者ID:klamonte,項目名稱:jermit,代碼行數:43,代碼來源:SwingTerminal.java

示例7: isEditEvent

private boolean isEditEvent(int row, int column, MouseEvent me) {
    if (me.getClickCount() > 1) {
        return true;
    }
    boolean noModifiers = me.getModifiersEx() == MouseEvent.BUTTON1_DOWN_MASK;
    if (lastEditPosition != null && selectedRow == row && noModifiers &&
        lastEditPosition[0] == row && lastEditPosition[1] == column) {

        int handleWidth = DefaultOutlineCellRenderer.getExpansionHandleWidth();
        Insets ins = getInsets();
        TreePath path = getLayoutCache().getPathForRow(convertRowIndexToModel(row));
        int nd = path.getPathCount() - (isRootVisible() ? 1 : 2);
        if (nd < 0) {
            nd = 0;
        }
        int handleStart = ins.left + (nd * DefaultOutlineCellRenderer.getNestingWidth());
        int handleEnd = ins.left + handleStart + handleWidth;
        // Translate 'x' to position of column if non-0:
        int columnStart = getCellRect(row, column, false).x;
        handleStart += columnStart;
        handleEnd += columnStart;
        if (me.getX() >= handleEnd) {
            lastEditPosition = null;
            return true;
        }
    }
    lastEditPosition = new int[] { row, column };
    return false;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:29,代碼來源:Outline.java

示例8: mouseMoved

/** Tracks mouse pointer location */
@Override
public void mouseMoved(MouseEvent e) {
    if (autoSlideTrigger.isEnabled()) {
        curMouseLocX = e.getX();
        curMouseLocY = e.getY();
    }
    // #54764 - start
    if (pressingButton && (e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) == 0) {
        pressingButton = false;
        autoSlideTrigger.activateAutoSlideInGesture(); 
    }
    // #54764 - end
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:SlideGestureRecognizer.java

示例9: mouseEntered

public void mouseEntered(MouseEvent e) {
    if ((e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) != 0) {
        state = STATE_NORMAL;
    } else {
        state = STATE_FOCUSED;
    }
    setFocusedThread();
    changeIcon();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:ClickableIcon.java

示例10: mouseReleased

/**
 * Sets the selection rectangle
 *
 * @param e
 */
@Override
public void mouseReleased(MouseEvent e) {
    if (startPoint == null) {
        return;
    }
    if ((e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) == MouseEvent.BUTTON1_DOWN_MASK) {
        setSelectionRectangleFromMouseEvent(e);
    } else if ((e.getModifiersEx() & MouseEvent.BUTTON3_DOWN_MASK) == MouseEvent.BUTTON3_DOWN_MASK) {
        stats.temporalNoise.setTemporalNoiseLineFromMouseEvent(e);
    }
    selecting = false;
}
 
開發者ID:SensorsINI,項目名稱:jaer,代碼行數:17,代碼來源:ApsNoiseStatistics.java

示例11: mouseDragged

/**
 * Sets the selection rectangle
 *
 * @param e
 */
@Override
public void mouseDragged(MouseEvent e) {
    if (startPoint == null) {
        return;
    }
    if ((e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) == MouseEvent.BUTTON1_DOWN_MASK) {
        setSelectionRectangleFromMouseEvent(e);
    } else if ((e.getModifiersEx() & MouseEvent.BUTTON3_DOWN_MASK) == MouseEvent.BUTTON3_DOWN_MASK) {
        stats.temporalNoise.setTemporalNoiseLineFromMouseEvent(e);
    }
}
 
開發者ID:SensorsINI,項目名稱:jaer,代碼行數:16,代碼來源:ApsNoiseStatistics.java

示例12: mouseDragged

@Override
public void mouseDragged(MouseEvent me) {
    // convert point in case we got triggered by a libraryPanel
    Point clickPoint = me.getPoint();
    //System.out.println("me.source: "+me.getSource());
    
    if(me.getSource() instanceof LibraryPanel)
    {
        clickPoint = new java.awt.Point(me.getLocationOnScreen());
        SwingUtilities.convertPointFromScreen(clickPoint, this);
        /*
        // get the selected item if there is any
        if(selected==null)
        {
            if(Library.getInstance().getSelected()!=null)
            {
                selected = Library.getInstance().getSelected().clone();
                selectedDelta = (Dimension) Library.getInstance().getSelectedDelta().clone();
                elements.add(selected);
            }
        }/**/
    }
    
    if(((me.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) != 0))
    {
        if(selected!=null)
        {
            // disconnect it!
            selected.setParent(null);
            
            // move element
            selected.setOffset(new Point(clickPoint.x-selectedDelta.width,
                                         clickPoint.y-selectedDelta.height));
            if(selected.isElementary())
            {
                selected.setOffset(new Point((clickPoint.x-selectedDelta.width) -((clickPoint.x-selectedDelta.width) % 10),
                                             (clickPoint.y-selectedDelta.height)-((clickPoint.y-selectedDelta.height)% 10)));
            }
            for (int i = 0; i < elements.size(); i++) {
                Element get = elements.get(i);
                get.cleanDockStatus();
                // check if docking is possible
                Element dock = get.canDock(selected);                      
            }
            //System.out.println("Dock: "+dock);
        }

        repaint();
    }
}
 
開發者ID:fesch,項目名稱:Moenagade,代碼行數:50,代碼來源:BloxsEditor.java

示例13: mouseDragged

@Override
public void mouseDragged(MouseEvent e) {
    if ((e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) != 0) {
        setLocation(e.getXOnScreen() - x, e.getYOnScreen() - y);
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:6,代碼來源:Ruler.java


注:本文中的java.awt.event.MouseEvent.BUTTON1_DOWN_MASK屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。