-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShape.java
More file actions
48 lines (41 loc) · 1.34 KB
/
Copy pathShape.java
File metadata and controls
48 lines (41 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics2D;
import java.io.Serializable;
abstract public class Shape implements Serializable
{
protected transient ShapeManager mShapeManager;
protected Point mPoint1;
protected Point mPoint2;
protected ShapeID mShapeID = ShapeID.DEFAULT_SHAPE;
protected Color mPenColor = Color.BLUE;
protected Color mFillColor = null;
protected LineThickness mLineThickness = LineThickness.THIN_LINE;
protected boolean mCompleted = false;
public Shape (ShapeManager shapeManager, Point point)
{
mShapeManager = shapeManager;
mShapeID = shapeManager.getCurShapeID();
mPenColor = shapeManager.getCurPenColor();
mFillColor = shapeManager.getCurFillColor();
mLineThickness = shapeManager.getCurLineThickness();
mPoint1 = new Point(point);
mPoint2 = new Point(point);
}
public boolean checkCompleted()
{
return mCompleted;
}
public void processMousePressed(Point point) {}
public void processMouseReleased(Point point)
{
mPoint2.setLocation(point);
mCompleted = true;
}
public void processMouseDragged(Point point)
{
mPoint2.setLocation(point);
mCompleted = false;
}
abstract public void drawShape(Graphics2D g2);
}