Java examples for Swing:Mouse Event
Returns, whether the left mouse button was clicked.
//package com.java2s; import java.awt.event.MouseEvent; public class Main { /**/*from ww w .j a v a 2s . co m*/ * Returns, whether the left mouse button was clicked. * * @param evt mouse event * @return true if the left mouse button was clicked */ public static boolean isLeftClick(MouseEvent evt) { if (evt == null) { throw new NullPointerException("evt == null"); } return evt.getButton() == MouseEvent.BUTTON1; } }