forked from sweskills/prog-method-assignment-2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgramHierarchy.java
executable file
·75 lines (42 loc) · 1.44 KB
/
ProgramHierarchy.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
* File: ProgramHierarchy.java
* Name:
* Section Leader:
* ---------------------------
* This file is the starter file for the ProgramHierarchy problem.
*/
import acm.graphics.*;
import acm.program.*;
import java.awt.*;
public class ProgramHierarchy extends GraphicsProgram {
private static final int HEIGHT = 50;
private static final int WIDTH = 150;
public void run() {
int x;
int y;
x = (getWidth() - WIDTH) / 2;
y = (getHeight() - HEIGHT) / 2;
GRect Rect = new GRect(x, y, WIDTH, HEIGHT);
add(Rect);
GLabel label1 = new GLabel("Program", (x + 50), (y + 30));
add(label1);
GLine Line1 = new GLine((x + 75), (y+50), (x+75), (y+100));
add(Line1);
GRect Rect2 = new GRect(x, (y+100), WIDTH, HEIGHT);
add(Rect2);
GLabel label2 = new GLabel("ConsoleProgram", (x + 30), (y + 130));
add(label2);
GLine Line2 = new GLine((x - 100), (y+100), (x+75), (y+50));
add(Line2);
GRect Rect3 = new GRect((x-175), (y+100), WIDTH, HEIGHT);
add(Rect3);
GLabel label3 = new GLabel("GraphicsProgram", (x - 145), (y + 130));
add(label3);
GLine Line3 = new GLine((x + 75), (y+50), (x+250), (y+100));
add(Line3);
GRect Rect4 = new GRect((x+175), (y+100), WIDTH, HEIGHT);
add(Rect4);
GLabel label4 = new GLabel("DialogProgram", (x + 210), (y + 130));
add(label4);
}
}