Package com.jme3.input.awt
Class AwtMouseInput
java.lang.Object
com.jme3.input.awt.AwtMouseInput
- All Implemented Interfaces:
Input
,MouseInput
,MouseListener
,MouseMotionListener
,MouseWheelListener
,EventListener
public class AwtMouseInput
extends Object
implements MouseInput, MouseListener, MouseWheelListener, MouseMotionListener
AwtMouseInput
-
Field Summary
Fields inherited from interface com.jme3.input.MouseInput
AXIS_WHEEL, AXIS_X, AXIS_Y, BUTTON_LEFT, BUTTON_MIDDLE, BUTTON_RIGHT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
Ceases listening to events from the device.int
Returns the number of buttons the mouse has.long
void
Initializes the native side to listen into events from the device.boolean
void
mouseClicked
(MouseEvent awtEvt) void
mouseDragged
(MouseEvent awtEvt) void
mouseEntered
(MouseEvent awtEvt) void
mouseExited
(MouseEvent awtEvt) void
mouseMoved
(MouseEvent awtEvt) void
mousePressed
(MouseEvent awtEvt) void
mouseReleased
(MouseEvent awtEvt) void
mouseWheelMoved
(MouseWheelEvent awtEvt) void
setCursorVisible
(boolean visible) Set whether the mouse cursor should be visible or not.void
setInputListener
(RawInputListener listener) Sets the input listener to receive events from this device.void
setInputSource
(Component comp) void
setNativeCursor
(JmeCursor cursor) Sets the cursor to use.void
update()
Queries the device for input.
-
Field Details
-
WHEEL_AMP
public static int WHEEL_AMP
-
-
Constructor Details
-
AwtMouseInput
public AwtMouseInput()
-
-
Method Details
-
setInputSource
-
initialize
public void initialize()Description copied from interface:Input
Initializes the native side to listen into events from the device.- Specified by:
initialize
in interfaceInput
-
destroy
public void destroy()Description copied from interface:Input
Ceases listening to events from the device. -
isInitialized
public boolean isInitialized()- Specified by:
isInitialized
in interfaceInput
- Returns:
- True if the device has been initialized and not destroyed.
- See Also:
-
setInputListener
Description copied from interface:Input
Sets the input listener to receive events from this device. The appropriate events should be dispatched through the callbacks in RawInputListener.- Specified by:
setInputListener
in interfaceInput
- Parameters:
listener
- the desired listener
-
getInputTimeNanos
public long getInputTimeNanos()- Specified by:
getInputTimeNanos
in interfaceInput
- Returns:
- The current absolute time as nanoseconds. This time is expected to be relative to the time given in InputEvents time property.
-
setCursorVisible
public void setCursorVisible(boolean visible) Description copied from interface:MouseInput
Set whether the mouse cursor should be visible or not.- Specified by:
setCursorVisible
in interfaceMouseInput
- Parameters:
visible
- Whether the mouse cursor should be visible or not.
-
update
public void update()Description copied from interface:Input
Queries the device for input. All events should be sent to the RawInputListener set with setInputListener. -
getButtonCount
public int getButtonCount()Description copied from interface:MouseInput
Returns the number of buttons the mouse has. Typically 3 for most mice.- Specified by:
getButtonCount
in interfaceMouseInput
- Returns:
- the number of buttons the mouse has.
-
mouseClicked
- Specified by:
mouseClicked
in interfaceMouseListener
-
mousePressed
- Specified by:
mousePressed
in interfaceMouseListener
-
mouseReleased
- Specified by:
mouseReleased
in interfaceMouseListener
-
mouseEntered
- Specified by:
mouseEntered
in interfaceMouseListener
-
mouseExited
- Specified by:
mouseExited
in interfaceMouseListener
-
mouseWheelMoved
- Specified by:
mouseWheelMoved
in interfaceMouseWheelListener
-
mouseDragged
- Specified by:
mouseDragged
in interfaceMouseMotionListener
-
mouseMoved
- Specified by:
mouseMoved
in interfaceMouseMotionListener
-
setNativeCursor
Description copied from interface:MouseInput
Sets the cursor to use.- Specified by:
setNativeCursor
in interfaceMouseInput
- Parameters:
cursor
- The cursor to use.
-