Java Reference
In-Depth Information
<html>
<head><title>GisApplet</title></head>
<body BGCOLOR # "#ffffff"">
<APPLET CODE # "gis.client.GisApplet.class" CODEBASE # "."
WIDTH # "700" HEIGHT # "600">
<PARAM NAME # MAPLIST
VALUE # "RomanItaly | RomeEurope | RomeMediterraneum" >
</APPLET>
</body>
</html>
Figure 15.13 The HTML code that embeds the GIS Applet
// equal to the localhost for test purposes
String HOST # "127.0.0.1";
int PORT # 2002;
boolean connected # false ;
BufferedReader input # null ;
PrintWriter output # null ;
CartographicMap mapWindow # new CartographicMap ();
DataWindow dataWindow # null ;
public synchronized void init() {
// loads the list of available maps from the HTML file
ArrayList mapList # new ArrayList();
String mapNameList # getParameter("MAPLIST");
if (mapNameList ## null ) return ;
StringTokenizer tokenizer #
new StringTokenizer(mapNameList, " | ");
while (tokenizer.hasMoreTokens()) {
String mapName # tokenizer.nextToken();
mapList.add(mapName);
}
// connect to the remote server
try {
socket # new Socket(HOST, PORT);
input # new BufferedReader(
new InputStreamReader(socket.getInputStream()));
output # new PrintWriter(socket.getOutputStream(),
false );
} catch (Exception e) {
e.printStackTrace();
return ;
}
// the list of available cartographic maps is shown in a
// menu of the graphical interface; when an item is
// selected, the following method is executed
 
Search WWH ::




Custom Search