org.apache.pivot.wtk
Class Mouse

java.lang.Object
  extended by org.apache.pivot.wtk.Mouse

public final class Mouse
extends Object

Class representing the system mouse.


Nested Class Summary
static class Mouse.Button
          Enumeration representing mouse buttons.
static class Mouse.ScrollType
          Enumeration defining supported scroll types.
 
Constructor Summary
Mouse()
           
 
Method Summary
static void capture(Component capturerArgument)
          "Captures" the mouse, causing all mouse input to be delegated to the given component rather than propagating down the component hierarchy.
static int getButtonCount()
          Returns the number of mouse buttons.
static int getButtons()
          Returns a bitfield representing the mouse buttons that are currently pressed.
static Component getCapturer()
          Returns the mouse capturer.
static Cursor getCursor()
          Returns the current cursor.
static boolean isPressed(Mouse.Button button)
          Tests the pressed state of a button.
static void release()
          Releases mouse capture, causing mouse input to resume propagation down the component hierarchy.
protected static void setButtons(int buttons)
           
static void setCursor(Component component)
          Sets the cursor based on a given component.
static void setCursor(Cursor cursor)
          Sets the cursor to an explicit value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Mouse

public Mouse()
Method Detail

getButtons

public static int getButtons()
Returns a bitfield representing the mouse buttons that are currently pressed.


setButtons

protected static void setButtons(int buttons)

isPressed

public static boolean isPressed(Mouse.Button button)
Tests the pressed state of a button.

Parameters:
button -
Returns:
true if the button is pressed; false, otherwise.

getButtonCount

public static int getButtonCount()
Returns the number of mouse buttons.


capture

public static void capture(Component capturerArgument)
"Captures" the mouse, causing all mouse input to be delegated to the given component rather than propagating down the component hierarchy.

Parameters:
capturerArgument - The component that wants to capture the mouse. The mouse pointer must currently be over the component.

release

public static void release()
Releases mouse capture, causing mouse input to resume propagation down the component hierarchy.


getCapturer

public static Component getCapturer()
Returns the mouse capturer.

Returns:
The component that has captured the mouse, or null if the mouse is not currently captured.

getCursor

public static Cursor getCursor()
Returns the current cursor.

Throws:
IllegalStateException - If the mouse is not currently captured.

setCursor

public static void setCursor(Cursor cursor)
Sets the cursor to an explicit value.

Parameters:
cursor -
Throws:
IllegalStateException - If the mouse is not currently captured.

setCursor

public static void setCursor(Component component)
Sets the cursor based on a given component.

Parameters:
component -