[OpenMap Users] MyApplet not inited

From: ³¯ÃÙ¦t <chanyu@ofdc.org.tw>
Date: Fri May 28 2004 - 05:32:46 EDT

Dear Don
 
Thanx for the reply
I try to follow ur instruction
 
I created a path named MyApplet under tomcat Like this "Tomcat 4.1\webapps\ROOT\MyApplet"
And put
1.MyApplet.html
2.Data\shape\dcwpo-browse.shp , dcwpo-browse.ssx
3.Myapplet\MyApplet.class
In the path
 
But when I try http://localhost:8080/MyApplet/MyApplet.html
still cant get it work....not inited
Not knowing what when wrong
I think I better post my full code here
Maybe u can tell me whats missing
Thanx for ur help and valued time, Don
 
Here is the code
<code MyApplet.java>
package myapplet;
 
import java.awt.*;
import javax.swing.*;
import java.util.*;
import java.util.Properties;
import com.bbn.openmap.MapBean;
import com.bbn.openmap.MapHandler;
import com.bbn.openmap.layer.shape.ShapeLayer;
import com.bbn.openmap.layer.GraticuleLayer;
import com.bbn.openmap.LatLonPoint;
 
public class MyApplet extends JApplet {
  private boolean isStandalone = false;
  MapHandler mapHandler = new MapHandler();
  MapBean mapBean = new MapBean();
  ShapeLayer shapeLayer = new ShapeLayer();
  GraticuleLayer graticuleLayer = new GraticuleLayer();
  Properties shapeLayerProps = new Properties();
  Properties graticuleLayerProps = new Properties();
  BorderLayout borderLayout1 = new BorderLayout();
 
  //Get a parameter value
  public String getParameter(String key, String def) {
    return isStandalone ? System.getProperty(key, def) :
      (getParameter(key) != null ? getParameter(key) : def);
  }
 
  //Construct the applet
  public MyApplet() {
  }
 
  //Initialize the applet
  public void init() {
    try {
      jbInit();
    }
    catch(Exception e) {
      e.printStackTrace();
    }
  }
 
  //Component initialization
  private void jbInit() throws Exception {
    this.setSize(new Dimension(400, 300));
    this.getContentPane().setLayout(borderLayout1);
    this.getContentPane().add(mapBean, BorderLayout.CENTER);
  }
 
  //Start the applet
  public void start() {
 
    mapBean.setCenter(new LatLonPoint(0, 0));
    mapBean.setScale(80000000f);
    graticuleLayerProps.put("prettyName", "Graticule");
    graticuleLayerProps.put("showRuler", "true");
    graticuleLayerProps.put("show1And5Lines", "true");
    graticuleLayer.setProperties(graticuleLayerProps);
    mapBean.add(graticuleLayer);
    shapeLayerProps.put("prettyName", "Political Solid");
    shapeLayerProps.put("lineColor", "000000");
    shapeLayerProps.put("fillColor", "BDDE83");
    shapeLayerProps.put("shapeFile","data/shape/dcwpo-browse.shp");
    shapeLayerProps.put("spatialIndex","data/shape/dcwpo-browse.ssx");
    shapeLayer.setProperties(shapeLayerProps);
    mapBean.add(shapeLayer);
    mapHandler.add(mapBean);
  }
 

  //Get Applet information
  public String getAppletInfo() {
    return "Applet Information";
  }
 
  //Get parameter info
  public String[][] getParameterInfo() {
    return null;
  }
 
}
</code>
 
<code MyApplet.html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Big5"> <title> HTML Test Page </title> </head> <body> myapplet.MyApplet will appear below in a Java enabled browser.<br> <applet
  codebase = "."
  code = "myapplet.MyApplet.class"
  name = "TestApplet"
  width = "400"
  height = "300"
  hspace = "0"
  vspace = "0"
  align = "middle"
>
</applet>
</body>
</html>
</code>

--
[To unsubscribe to this list send an email to "majdart@bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Fri May 28 05:34:51 2004

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:38 EDT