简体   繁体   中英

Adding parameters using deployjava.js from old applet

I am using deployjava.js to deploy this applet

<script src="http://java.com/js/deployJava.js"></script><script> 
    var attributes = {codebase: '/devel/app/webroot/jpainter/applet',code: 'Painter.class', archive:'painter.jar', width:640, height:480} ; 
    var parameters = {jnlp_href: 'plugin2.jnlp'} ; 
    deployJava.runApplet(attributes, parameters, '1.6'); 
</script>

The API for the applet says to pass these params (specifically the canvas)

I tried this

<script src="http://java.com/js/deployJava.js"></script>
<script> 
var attributes = {codebase: '/devel/app/webroot/jpainter/applet',code:         'Painter.class', archive:'painter.jar', width:640, height:480} ; 
    var parameters = {jnlp_href: 'plugin2.jnlp', gui:'canvas.gui'} ; 
    deployJava.runApplet(attributes, parameters, '1.6'); 
</script>

And clearly that is not correct. What is the correct way to get this working?

JNLP

<resources> 
    <j2se version="1.4+"/> 
    <jar href="/devel/app/webroot/jpainter/applet/painter.jar"/> 
</resources> 

<applet-desc name="painter" main-class="Painter" width="640" height="480"> 
<param name="plugin2" value="true" />
</applet-desc> 
</jnlp>

In case someone stumbles upon this in the future, when you call the attribute and give it the location of your.jar file, it isn't needed to also reference the jnlp.

<script type="text/javascript" src="https://www.java.com/js/deployJava.js"></script>
<script type="text/javascript">
var attributes = {name: 'painter', codebase: BASE_DIR + '/app/webroot/jpainter/applet',code: 'Painter.class', archive:'painter.jar', width:742, height:262} ; 
var parameters = {gui:'canvas.gui', image_width:'740', image_height:'260', stroke:'solid3'};
var version = '1.6' ;
deployJava.runApplet(attributes, parameters, version);
</script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM