-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDraw_UC_Mode.java
36 lines (29 loc) · 984 Bytes
/
Draw_UC_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
// To implement the Mouse_Mode interface
import java.awt.event.MouseEvent;
//Draw USE CASE mode.
public class Draw_UC_Mode extends Mouse_Mode
{
public Draw_UC_Mode()
{
System.out.println("Draw a use case.");
}
@Override
public void mousePressed(MouseEvent e)
{
press_x = e.getX();
press_y = e.getY();
int new_depth = canvas.update_depth();
Basic_Object a_use_case = new Use_case(new_depth,press_x ,press_y);
//Update its' state: set the coordinate.
a_use_case.setLeft_up(e.getX(), e.getY());
//add to Current_object_status13 in CANVAS
canvas.get_Current_Obj_Status().add(a_use_case);
//After updating, just to draw; THE PRINCIPLE: 1. Logic 2. Update Properties 3. Draw the new status of the obj.
a_use_case.draw();
}
//the following actions are useless for drawing a class diagram on Panel
@Override
public void mouseDragged(MouseEvent arg0) {}
@Override
public void mouseReleased(MouseEvent arg0) {}
}