Java tutorial
//package com.java2s; //License from project: Apache License import java.awt.event.InputEvent; import java.awt.event.MouseEvent; public class Main { static boolean isLeftButtonOnly(final MouseEvent event) { final int modifiers = event.getModifiersEx(); if ((modifiers & InputEvent.BUTTON1_DOWN_MASK) == InputEvent.BUTTON1_DOWN_MASK) { for (int button = 11; button <= 30; button++) { final int mask = 1 << button; if ((modifiers & mask) == mask) { return false; } } return true; } return false; } }