// CS 134 demo program which displays coordinates
// of the mouse.
import objectdraw.*;
import java.awt.*;
public class MouseMeter extends WindowController {
private static final int DISPLAY_X = 150; // Location of display
private static final int DISPLAY_Y = 200;
private Text display; // Display showing mouse coords
// Create and display instructions
public void begin()
{
display = new Text("Move the mouse", DISPLAY_X, DISPLAY_Y, canvas);
}
// Update mouse coordinates in display
public void onMouseMove(Location point)
{
display.setText("(" + point.getX() + "," +
point.getY() + ")" );
}
}