- package cn.edu.nju.software.grapheditor.cmd;
- import java.awt.Point;
- import cn.edu.nju.software.grapheditor.Drawing;
- import cn.edu.nju.software.grapheditor.shape.Segment;
- public class LineCmd extends Command{
- Segment s;
- public void executePress(Point p,Drawing dwg){
- s=new Segment(dwg.currentColor);
- s.startPoint =p;
- s.endPoint =p;
- dwg.a.add(s);
- }
- public void executeDrag(Point p, Drawing dwg) {
- s.endPoint =p;
- }
- }