Hello,
I have a java application in which when starting it a map is opened and a screen is captured. The capturing is in certain time interval. I want to enable the user to change the interval for the automatic capturing the map. I placed a text box in a JPanel. I want to pass the value which was entered in it to the html page which opens a Google map. Since I am new in java programming, I found that I can do it by using applets. I made an applet, and tried to call it in the html file. But now instead of opening the map file in a browser, it opens very quickly only black window.
Here is my applet:
package cege.ui;
import java.applet.Applet;
import java.io.IOException;
import cege.ui.GuiMain;
public class AppletTInterval extends Applet {
private int TimeInterval=0;
public void init() {
try {
TimeInterval=GuiMain.TRAFFIC_REFRESH_RATE;
}
catch (Exception e) {
e.printStackTrace();
}
}
public int getTimeInterval () {
return TimeInterval;
}
}
and the code in the html file where I try to call the applet, i.e. to pass the value which is returned by the applet is:
<script src=
<!--"https://www.java.com/js/deployJava.js"></script>
<script>
var attributes = { id:'AppletTInterval',
code:'cege.ui.AppletTInterval', width:1, height:1} ;
var parameters = { jnlp_href: 'AppletTInterval.jnlp'} ;
deployJava.runApplet(attributes, parameters, '1.6');
</script>
<script type="text/javascript">
TRAFFIC_REFRESH_RATE = AppletTInterval.getTimeInterval();
if(TRAFFIC_REFRESH_RATE = 0)
{
var TRAFFIC_REFRESH_RATE = 20000;
}
else
{
TRAFFIC_REFRESH_RATE = AppletTInterval.getTimeInterval()
}
Can anybody help me please, what should I do, where I make a mistake, or can I use this way to pass a value from the java class file (from the JTextField into the html file?
Thank you in advance.