-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtoolbar_old.java
More file actions
executable file
·141 lines (131 loc) · 3.56 KB
/
toolbar_old.java
File metadata and controls
executable file
·141 lines (131 loc) · 3.56 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
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/*
* toolbar.java
*
* Created on March 16, 2006, 8:25 PM
*/
/**
* @author Chen-Fu Liao
* Sr. Systems Engineer
* ITS Institute, ITS Laboratory
* Center For Transportation Studies
* University of Minnesota
* 200 Transportation and Safety Building
* 511 Washington Ave. SE
* Minneapolis, MN 55455
*/
import java.awt.*;
import java.applet.*;
import java.net.URL;
public class toolbar_old extends Panel
{
int n;
int status = -1;
Color cstat = new Color(254,254,254);
hDrawArea parent;
toolbar_old()
{
setBackground(Color.lightGray);
}
public void paint(Graphics g)
{
Rectangle r = bounds();
for(int i=0;i<10;i++)
{
if(i==status)
{
g.setColor(new Color(192,192,192));
g.fillRect(i*33, 0,32,32);
}
g.setColor(Color.black);
g.drawLine(i*33+32, 0,i*33+32, 32);
URL url = null;
switch (i) {
case 0:
url = getClass().getResource("Arrow.png");
break ;
case 1:
url = getClass().getResource("ZoomIn.png");
break ;
case 2:
url = getClass().getResource("ZoomOut.png");
break ;
case 3:
url = getClass().getResource("Move.png");
break ;
case 4:
url = getClass().getResource("Line.png");
break ;
case 5:
url = getClass().getResource("Curve.png");
break ;
case 6:
url = getClass().getResource("modify.png");
break ;
case 7:
url = getClass().getResource("markerH.png");
break ;
case 8:
url = getClass().getResource("Refresh1.png");
break ;
case 9:
url = getClass().getResource("vertical_align1.png");
break ;
}
Image img = Toolkit.getDefaultToolkit().getImage(url);
g.drawImage(img, i*33+4,4,this) ;
} // i
}
public Dimension preferredSize()
{
return(new Dimension(32,32));
}
public boolean mouseDown(Event e, int x, int y)
{
if(x<10*33)
{
int oldstatus = status;
status = x/33;
if(status<0) status = 0;
if(status>9) status = 9;
//if(oldstatus!=status)
//{
String str = "" ;
switch (status) {
case 0:
str = " Select Segment" ;
break ;
case 1:
str = " Zoom In" ;
break ;
case 2:
str = " Zoom Out" ;
break ;
case 3:
str = " Move" ;
break ;
case 4:
str = " Line Tool" ;
break ;
case 5:
str = " Curve Tool" ;
break ;
case 6:
str = " Modify End Point" ;
break ;
case 7:
str = " Set Station/Landmark" ;
break ;
case 8:
str = " Refresh" ;
break ;
case 9:
str = " Vertical Alignment" ;
break ;
} // switch
parent.newstatus(status, str);
repaint();
//}
}
return(true);
}
}