-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDraw_CD_Mode.java
38 lines (31 loc) · 946 Bytes
/
Draw_CD_Mode.java
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
import java.awt.event.MouseEvent;
//Draw CLASS DIAGRAM Mode.
public class Draw_CD_Mode extends Mouse_Mode
{
public Draw_CD_Mode()
{
System.out.println("Draw a class_diargram.");
}
@Override
public void mousePressed(MouseEvent e)
{
press_x = e.getX();
press_y = e.getY();
int new_depth = canvas.update_depth();
Shape a_class = new Shape(new_depth,press_x,press_y );
//Update its' state: set the coordinate.
a_class.setLeft_up(e.getX(), e.getY());
//add to Current_object_status13 in CANVAS
canvas.get_Current_Obj_Status().add(a_class);
//After updating, just to draw; THE PRINCIPLE: 1. Logic 2. Update Properties 3. Draw the new status of the obj.
a_class.draw();
}
@Override
public void mouseDragged(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void mouseReleased(MouseEvent arg0) {
// TODO Auto-generated method stub
}
}