import objectdraw.*;
import java.awt.*;
/* A program that draws perpendicular lines that move
so that they always intersect at the mouse's current
position */
public class CrossHairs extends WindowController {
private Line vert, horiz; // vertical and horizontal intersecting lines
// Initially center the lines
public void begin()
{
vert = new Line( 200, 0, 200, 400, canvas );
horiz = new Line( 0, 200, 400, 200, canvas );
}
// move the lines so that they intersect at the mouse
public void onMouseDrag(Location point)
{
vert.setEndPoints( point.getX(), 0 ,
point.getX(), 400 );
horiz.setEndPoints( 0, point.getY() ,
400, point.getY() );
}
}