-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstatusbarV.java
More file actions
executable file
·83 lines (72 loc) · 1.7 KB
/
statusbarV.java
File metadata and controls
executable file
·83 lines (72 loc) · 1.7 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
/*
* statusbarV.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.net.URL;
public class statusbarV extends Panel
{
String statusStr = "Status: " ;
String errorStr = "Error: " ;
//Color cstat = new Color(200,200,200);
vDrawArea parent ;
int[] panelWidth = {250,550} ;
int panelHeight=20 ;
statusbarV()
{
setBackground(Color.lightGray);
}
public void paint(Graphics g)
{
Rectangle r = bounds();
int start = 0;
for(int i=0;i<2;i++)
{
g.setColor(Color.lightGray);
g.fillRect(start, 0,start,panelHeight);
g.setColor(Color.black);
g.drawLine(start, 0,start, panelHeight);
switch (i) {
case 0:
g.drawString(statusStr, start+2, panelHeight-4);
break ;
case 1:
g.drawString(errorStr, start+2, panelHeight-4);
break ;
}
start += panelWidth[i] ;
} // i
}
public Dimension preferredSize()
{
return(new Dimension(panelWidth[0],panelHeight));
}
public boolean mouseDown(Event e,int x,int y)
{
return(true);
}
public boolean setStatusBarText(int index, String str)
{
switch (index) {
case 0:
statusStr = "Status: " + str;
break ;
case 1:
errorStr = "Error: " + str;
break ;
}
repaint();
return(true);
}
}