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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
package imaging.framework;
import java.awt.*;
import java.awt.image.*;
class DialogManager
{
public static void popDialog (int type, String message)
{
Frame frame = null;
switch (type)
{
case DialogType.ABOUT:
frame = new AboutFrame ();
break;
case DialogType.MALFORMED_URL:
case DialogType.NOT_SUPPORTED:
case DialogType.URL_NOT_FOUND:
frame = new MessageFrame ("Error", message);
break;
case DialogType.NOT_YET_IMPLEMENTED:
frame = new MessageFrame ("", message);
break;
}
Dimension d = Toolkit.getDefaultToolkit ().getScreenSize ();
frame.move ((d.width - frame.size ().width)/2,
(d.height - frame.size ().height)/2);
frame.show ();
}
}
class MessageFrame extends Frame
{
public MessageFrame (String title, String message)
{
super (title);
this.resize (message.length () * 8, 100);
this.setLayout (new BorderLayout ());
this.text_ = new TextField (message);
this.text_.setEditable (false);
Panel okButtonPanel = new Panel ();
okButtonPanel.add (this.okButton_);
okButtonPanel.resize (100, 100);
this.add ("Center", this.text_);
this.add ("South", okButtonPanel);
}
public boolean handleEvent (Event evt)
{
if (evt.id == Event.WINDOW_DESTROY)
{
this.dispose ();
return true;
}
return super.handleEvent (evt);
}
// Handle all action events
public boolean action (Event e, Object arg)
{
if (e.target instanceof Button)
{
if (e.target == this.okButton_)
{
this.dispose ();
}
return true;
}
else
return false;
}
private Button okButton_ = new Button (" ok ");
private TextField text_ = null;
}
class AboutFrame extends Frame
{
public AboutFrame ()
{
super ("About");
this.setText ();
this.resize (500,700);
this.setLayout (new BorderLayout ());
Panel okButtonPanel = new Panel ();
okButtonPanel.add (this.okButton_);
this.add ("South", okButtonPanel);
}
public void paint (Graphics g)
{
g.clearRect (0, 0, this.size ().width, this.size ().height);
g.setFont (new Font ("TimesRoman", Font.PLAIN, 18));
this.setBackground (Color.white);
int x = 20;
int y = 100;
for (int i = 0; i < AboutFrame.MAXROWS; i++)
{
g.drawString(this.text_[i], x, y);
y += g.getFont ().getSize () + 5;
}
}
// Handle window destroy events
public boolean handleEvent (Event evt)
{
if (evt.id == Event.WINDOW_DESTROY)
{
this.dispose ();
return true;
}
return super.handleEvent (evt);
}
// Handle all action events
public boolean action (Event e, Object arg)
{
if (e.target instanceof Button)
{
if (e.target == this.okButton_)
{
this.dispose ();
}
return true;
}
else
return false;
}
private void setText ()
{
text_[0] = "This is a prototype of a large scale distributed medical";
text_[1] = "imaging system. It has been developed using Java, in";
text_[2] = "particular, several components of Java ACE.";
text_[3] = "";
text_[4] = "The prototype allows images to be downloaded across the";
text_[5] = "network. It then provides several filters that can be";
text_[6] = "used to do image processing. The image filters are";
text_[7] = "configured into the system dynamically using the Service";
text_[8] = "Configurator pattern. In the current implementation, the";
text_[9] = "filters are specified via a configuration file located at";
text_[10] = "server. The file can be modified at runtime to add";
text_[11] = "additional filters or to remove some filters. This allows";
text_[12] = "filters to be configured and reconfigured dynamically.";
text_[13] = "";
text_[14] = "Currently, images can not be uploaded. This is mainly due";
text_[15] = "to security restrictions imposed by current servers. Our";
text_[16] = "goal is to use the prototpe in conjunction with JAWS, an";
text_[17] = "adaptive web server we are currently developing in which we";
text_[18] = "plan to provide support for image uploading.";
text_[19] = "";
text_[20] = "For more information about this prototype, please contact";
text_[21] = "Prashant Jain (pjain@cs.wustl.edu).";
}
private final static int MAXROWS = 22;
private Button okButton_ = new Button (" ok ");
private TextArea textArea_ = null;
private String [] text_ = new String [AboutFrame.MAXROWS];
}
|