dasher.applet
Class JMouseInput

java.lang.Object
  extended by dasher.CDasherComponent
      extended by dasher.CDasherModule
          extended by dasher.CDasherInput
              extended by dasher.applet.JMouseInput
All Implemented Interfaces:
java.awt.event.MouseMotionListener, java.util.EventListener

public class JMouseInput
extends CDasherInput
implements java.awt.event.MouseMotionListener

Simple mouse input device which uses a mouse motion listener to track the mouse position and reports the latest reading when GetCoordinates is called.

Only methods which differ significantly from their abstract meanings documented in CDasherInput are documented here; for further details see CDasherInput.


Field Summary
private  int mouseX
          Last seen mouse X co-ordinate
private  int mouseY
          Last seen mouse Y co-ordinate
 
Fields inherited from class dasher.CDasherComponent
m_EventHandler, m_SettingsStore
 
Constructor Summary
JMouseInput(CEventHandler EventHandler, CSettingsStore SettingsStore)
           
 
Method Summary
 int GetCoordinateCount()
          Gets the number of co-ordinates this device returns.
 int GetCoordinates(int iN, long[] Coordinates)
          Called to request that the device report the current co-ordinates.
 void mouseDragged(java.awt.event.MouseEvent e)
          Ignored
 void mouseMoved(java.awt.event.MouseEvent e)
          Nasty hack alert! At present, this stores the read mouse co-ordinates less 10 in the X direction and 30 in the Y direction, since this is the border in the current setup of JDasher.
 
Methods inherited from class dasher.CDasherInput
Activate, Deactivate, SetMaxCoordinates
 
Methods inherited from class dasher.CDasherModule
GetID, GetName, GetType, Ref, Unref
 
Methods inherited from class dasher.CDasherComponent
GetBoolParameter, GetLongParameter, GetParameterName, GetParameterType, GetStringParameter, HandleEvent, InsertEvent, SetBoolParameter, SetLongParameter, SetStringParameter, UnregisterComponent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mouseX

private int mouseX
Last seen mouse X co-ordinate


mouseY

private int mouseY
Last seen mouse Y co-ordinate

Constructor Detail

JMouseInput

public JMouseInput(CEventHandler EventHandler,
                   CSettingsStore SettingsStore)
Method Detail

GetCoordinateCount

public int GetCoordinateCount()
Description copied from class: CDasherInput
Gets the number of co-ordinates this device returns.

At present, only 1- and 2-axis devices are accepted, but this may be easily upgraded in the future.

Specified by:
GetCoordinateCount in class CDasherInput
Returns:
Number of co-ordinates supplied by this device.

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Ignored

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Nasty hack alert! At present, this stores the read mouse co-ordinates less 10 in the X direction and 30 in the Y direction, since this is the border in the current setup of JDasher. This means that it will break if the Panel is moved elsewhere on the screen.

This needs to be generalised so that we offset the co-ordinates appropriately and respond to changes in the Screen's position.

Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

GetCoordinates

public int GetCoordinates(int iN,
                          long[] Coordinates)
Description copied from class: CDasherInput
Called to request that the device report the current co-ordinates.

Specified by:
GetCoordinates in class CDasherInput
Parameters:
iN - Number of co-ordinates expected.
Coordinates - Fill with the current co-ordinates
Returns:
0 if those reported are screen co-ordinates, or 1 if they are Dasher world co-ordinates.