jbox- java applet notinited

Dan Liu Dan.Liu at STATE.MN.US
Thu Dec 9 14:47:00 EST 2004


Hi Richard,
Thanks first for answering. I called 'document.jBox.boxon()' when zoom in
button is clicked. (See the demo.html below) Is this function call causing
the problem?

<html>
<!--
<head><title>MapServer Demo Interface</title></head>
-->
<head>
      <title>MapServer Demo Interface</title>

      <SCRIPT LANGUAGE="JavaScript">

        function setbox_handler(name, minx, miny, maxx, maxy) {
          document.mapserv.imgbox.value = minx + " " + miny + " " + maxx + "
" + maxy;
          document.mapserv.imgxy.value = minx + " " + miny;
          // Additional code can go here prior to the form submit, below.
          // For example, form validation code.
          document.mapserv.submit();
        }

        function seterror_handler(message) {
          alert(message);
        }

      </SCRIPT>
    </head>
<body bgcolor=#FFFFFF>

<center><h1>MapServer Demo Interface</h1></center>
<hr>
<!--
<form method=GET action="[program]">
-->
<form name="mapserv" method=GET action="[program]">
<center>
<table border=0 cellspacing=0 cellpadding=4 bgcolor="#000000">
<tr>
<td valign="top" align=center>
  <table cellpadding="0" cellspacing="0" border="0">
<!--
    <tr><td colspan="2"><INPUT NAME="img" TYPE="image" SRC="[img]" width=600
height=600 border=0></td></tr>
-->

        <tr>
          <td colspan="2">
            <applet
                  codebase="[host]/java/jBox"
                  code="jBoxPNG.class"
                  archive="jBoxPNG.jar,png.jar"
                  width="500"
                  height="500"
                  name="jBox"
                  MAYSCRIPT>
              <param name="image" value="[host][img]">
            </applet>
          </td>
        </tr>
    <tr>
      <td>&nbsp;<font size=-1 face="arial,helvetica"
color="#FFFFFF"><b>Powered by MapServer</b></font></td>
      <td align="right"><img src="[scalebar]"></td>
    </tr>
  </table>
</td>
<td valign="top" bgcolor=#ffffff>
  <table cellpadding="5" cellspacing="0" border="0" bgcolor="#ffffff">
    <tr><td>
      <center><input type="submit" value="Refresh/Query"></center>
      <p>

      <input type="radio" name="mode" value="browse" checked> <b>Browse
map</b><br>
      <input type="radio" name="mode" value="query"> <b>Query
feature</b><br>
      <input type="radio" name="mode" value="nquery"> <b>Query multiple
features</b>

      <hr>

      <p>
      <b>Select Layers to Display: </b><br>
      <select multiple name="layer" size=3>
        <option value="airports" [airports_select]> Airports
        <option value="cities" [cities_select]> Cities
        <option value="lakespy2" [lakespy2_select]> Lakes & Rivers
        <option value="dlgstln2" [dlgstln2_select]> Streams
        <option value="roads" [roads_select]> Roads
        <option value="twprgpy3" [twprgpy3_select]> Townships
      </select>

      <p>
      Zoom In <input type=radio name=zoomdir value=1
OnClick='document.jBox.boxon()' [zoomdir_1_check]>
      Pan <input type=radio name=zoomdir value=0
OnClick='document.jBox.dragon()' [zoomdir_0_check]>
      Zoom Out <input type=radio name=zoomdir value=-1
OnClick='document.jBox.boxoff()' [zoomdir_-1_check]>
      <p>
      Zoom Size <input type=text name=zoomsize size=4 value=[zoomsize]>
      <p>

      <font size=+1><b>Legend</b></font><br><hr>
      <img src="[legend]"><hr>

      <p>
      <center><INPUT NAME="ref" TYPE="image" SRC="[ref]"
border="0"></center>
    </td></tr></table>

  </td></tr>
</table>
</center>

<input type="hidden" name="imgxy" value="299.5 299.5">
<input type="hidden" name="imgext" value="[mapext]">
<input type="hidden" name="map" value="[map]">
<input type="hidden" name="savequery" value="true">

<input type="hidden" name="program" value="[program]">
<input type="hidden" name="map_web_imagepath" value="[map_web_imagepath]">
<input type="hidden" name="map_web_imageurl" value="[map_web_imageurl]">

<input type="hidden" name="imgbox" value="-1 -1 -1 -1">
</form>
<p><hr><p>
</body></html>

-----Original Message-----
From: Richard Greenwood [mailto:richard.greenwood at gmail.com]
Sent: Thursday, December 09, 2004 1:15 PM
To: Dan Liu
Cc: MAPSERVER-USERS at lists.umn.edu
Subject: Re: [UMN_MAPSERVER-USERS] jbox- java applet notinited

On Thu, 9 Dec 2004 12:49:21 -0600, Dan Liu <Dan.Liu at state.mn.us> wrote:
>
>
>
> Hi,
>
> In my demo.html file with JBox in it, I get 'applet jbox notinited error'
> once a while. The map is grey with a red 'x' at the top left of the map.
> Other than this, everything works fine.
>
>
>
> Does anybody know why?
>
> Thanks.
>
> Dan


I can not say for certain, but be sure not to call any jBox functions
while it is initializing. jBox initializes when the <APPLET ...> tag
gets read by the browser. I think that some browser/VM combinations
will continue to process the HTML page while the applet is still
loading. If the page then calls the applet, you will get the error you
describe.

For example, if you have a function that calls jBox.boxon()
immediately after the applet tag, you may get the error. So instead
use the parameter/value pair:
    <param name='box' value='on'>
within the applet tag, thus eliminating the possible conflict.

Regards,
--
Richard Greenwood
richard.greenwood at gmail.com
www.greenwoodmap.com



More information about the mapserver-users mailing list