CS 4773 Object Oriented Systems
RectLineMove.java
import java.awt.*;
public class RectLineMove extends RectLinePos
implements DelayCallBack {
private int delay;
private MoveCallBack cb;
private DelayThread dt;
public RectLineMove(Point start, Point end, Dimension dim, Color C,
int delay, MoveCallBack cb) {
super(start,end,dim,C);
this.delay = delay;
this.cb = cb;
dt = new DelayThread(delay,this);
}
public void kill() {
dt.kill();
}
public void stop() {
dt.PauseDelay();
}
public void start() {
dt.ContinueDelay();
}
public int GetDelay() {
return delay;
}
public void DelayNotification() {
NextPosition();
cb.MoveNotification();
}
public void NextPosition() {
super.NextPosition();
if (isDone())
dt.PauseDelay();
}
}