Interface TGMouseHandler

All Known Implementing Classes:
TurtleGraphicsWindow

public interface TGMouseHandler

TGMouseHandler is an interface that a class implements when it would like to receive Java AWT mouse events from TGCanvas. The provided methods are an attempt to reduce the complexity of the, more general, MouseListener and MouseMotionListener interfaces.

In the case of TG, TGDriver registers with TGCanvas, passing the events on to the current jLogo program, invoking specific user-defined procedures if they exist.

In the case of TurtleGraphicsWindow, the methods in this interface are stubs that should be overridden by child classes if they want to handle mouse input events.


Method Summary
 void tgMouseClicked(int x, int y)
          tgMouseClicked() is invoked by TGCanvas for all objects implementing TGMouseHander which have registered to receive the mouse click event when the left mouse button is clicked in the graphics canvas when it is active.
 void tgMouseMoved(int x, int y)
          tgMouseMoved() is invoked by TGCanvas, for all objects implementing TGMouseHander that have registered to receive mouse moved events when the mouse is moved within the graphics canvas when it's active.
 

Method Detail

tgMouseClicked

void tgMouseClicked(int x,
                    int y)
tgMouseClicked() is invoked by TGCanvas for all objects implementing TGMouseHander which have registered to receive the mouse click event when the left mouse button is clicked in the graphics canvas when it is active.

Parameters:
x - X coordinate of mouse's location on the graphics canvas
y - Y coordinate of mouse's location on the graphics canvas

tgMouseMoved

void tgMouseMoved(int x,
                  int y)
tgMouseMoved() is invoked by TGCanvas, for all objects implementing TGMouseHander that have registered to receive mouse moved events when the mouse is moved within the graphics canvas when it's active.

Parameters:
x - X coordinate of mouse's location on the graphics canvas
y - Y coordinate of mouse's location on the graphics canvas