bb.gui
Class MouseUtil

java.lang.Object
  extended by bb.gui.MouseUtil

public class MouseUtil
extends Object

This class provides static utility methods that deal with MouseEvents.

Like typical Java GUI code, this class is not multithread safe: it expects to only be called by EventQueue's dispatch thread. This threading limitation is checked in every public method.

Author:
Brent Boyer

Constructor Summary
private MouseUtil()
          This sole private constructor suppresses the default (public) constructor, ensuring non-instantiability outside of this class.
 
Method Summary
static boolean isDoubleClick(MouseEvent me)
          Determines whether the MouseEvent represents a double click.
static boolean isLeftMouseButtonClick(MouseEvent me)
          Determines whether the MouseEvent represents a click of the leftmost mouse button (buttion #1).
static boolean isMiddleMouseButtonClick(MouseEvent me)
          Determines whether the MouseEvent represents a click of the middle mouse button (buttion #2).
static boolean isRightMouseButtonClick(MouseEvent me)
          Determines whether the MouseEvent represents a click of the rightmost mouse button (buttion #3).
static boolean isSingleClick(MouseEvent me)
          Determines whether the MouseEvent represents a single click.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MouseUtil

private MouseUtil()
This sole private constructor suppresses the default (public) constructor, ensuring non-instantiability outside of this class.

Method Detail

isLeftMouseButtonClick

public static boolean isLeftMouseButtonClick(MouseEvent me)
                                      throws IllegalStateException
Determines whether the MouseEvent represents a click of the leftmost mouse button (buttion #1).

Throws:
IllegalStateException - if calling thread is not EventQueue's dispatch thread

isMiddleMouseButtonClick

public static boolean isMiddleMouseButtonClick(MouseEvent me)
                                        throws IllegalStateException
Determines whether the MouseEvent represents a click of the middle mouse button (buttion #2).

Throws:
IllegalStateException - if calling thread is not EventQueue's dispatch thread

isRightMouseButtonClick

public static boolean isRightMouseButtonClick(MouseEvent me)
                                       throws IllegalStateException
Determines whether the MouseEvent represents a click of the rightmost mouse button (buttion #3).

Throws:
IllegalStateException - if calling thread is not EventQueue's dispatch thread

isSingleClick

public static boolean isSingleClick(MouseEvent me)
                             throws IllegalStateException
Determines whether the MouseEvent represents a single click.

Throws:
IllegalStateException - if calling thread is not EventQueue's dispatch thread

isDoubleClick

public static boolean isDoubleClick(MouseEvent me)
                             throws IllegalStateException
Determines whether the MouseEvent represents a double click.

Throws:
IllegalStateException - if calling thread is not EventQueue's dispatch thread