开发者

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 vers开发者_开发问答ion="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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜