Java Reference
In-Depth Information
public void
mapItem_actionPerformed(ActionEvent e) {
String mapName
#
e.getActionCommand();
// loads the image file and map file
URL mapUrl
#
null
;
URL imageUrl
#
null
;
try
{
mapUrl
#
new
URL(this.getCodeBase(), mapName
!
".map");
String imageFile
#
mapWindow.openMap(
mapUrl.openStream());
StringTokenizer tokenizer
#
new
StringTokenizer(imageFile, "\\");
String fname
#
"";
while
(tokenizer.hasMoreElements())
fname
#
tokenizer.nextToken();
imageUrl
#
new
URL(this.getCodeBase(), fname);
Image image
#
(
new
ImageIcon(imageUrl)).getImage();
mapWindow.setImage(image);
}
catch
(Exception ex) {
return
; }
// loads the list of layers for the selected map
String layerList[]
#
mapWindow.getLayerList();
. . .
}
// invoked by the Web browser to kill the Applet
public void
destroy() {
output.println("Bye.");
}
// this method is invoked by the mouse handler when a
// geometric entity is selected
public void
setDataRecords(String dbInfo[], String key) {
dataWindow.resetRecords();
output.println("GETRECORD");
output.println(dbInfo[0]);
output.println(dbInfo[1]);
output.println(dbInfo[2]);
output.println(key);
output.flush();
// shows the record values in the data window
try
{
int
size
#
Integer.parseInt(this.input.readLine());
for
(
int
i
#
0; i < size; i
!!
) {
StringTokenizer tokenizer
#
new
StringTokenizer(input.readLine(), " ");
String attribute
#
tokenizer.nextToken();
String value
#
tokenizer.nextToken();
dataWindow.addRecord(attribute, value);
}
}