Java Swing Mouse isPrimaryMouseButton(MouseEvent e)

Here you can find the source of isPrimaryMouseButton(MouseEvent e)

Description

Tests if a MouseEvent was triggered by primary mouse button

License

Open Source License

Parameter

Parameter Description
e a parameter

Declaration

public static boolean isPrimaryMouseButton(MouseEvent e) 

Method Source Code

//package com.java2s;
/*/*from  ww w  .j  a v a2 s  .  c  om*/
     
 This file is part of Subclient.
     
 Subclient is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.
     
 Subclient is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 GNU General Public License for more details.
     
 You should have received a copy of the GNU General Public License
 along with Subclient. If not, see <http://www.gnu.org/licenses/>.
     
 Copyright 2012, 2013 Alejandro Celaya Alastru?
     
 */

import java.awt.event.MouseEvent;

import javax.swing.SwingUtilities;

public class Main {
    /**
     * Tests if a MouseEvent was triggered by primary mouse button
     * @param e
     * @return
     */
    public static boolean isPrimaryMouseButton(MouseEvent e) {
        return SwingUtilities.isLeftMouseButton(e) && !e.isControlDown();
    }
}

Related

  1. isDoubleClick(MouseEvent evt)
  2. isLeftButtonAndNoModifiers(final MouseEvent event)
  3. isLeftMouseButton(MouseEvent anEvent)
  4. isLeftMouseButton(MouseEvent e)
  5. isPopupTrigger(final MouseEvent e)
  6. makeMouseOverBorder(final JComponent b)
  7. mapDragOperationFromModifiers(MouseEvent me, TransferHandler th)
  8. paintBandTitle(Graphics g, Rectangle titleRectangle, String title, boolean isUnderMouse, boolean hasExpandIcon)
  9. parentMouseEvent(JComponent c, MouseEvent m)