1

如果是这样,有人可以指出我的例子吗?甚至一些代码?!

我猜我不能作为嵌入到小工具中的小程序使用以下...

var div = document.getElementById('content_div');

div.innerHTML = 
    "<applet CODE='http://www.echoecho.com/lake.class' width='370' height='200'>
        <param name='image' value='http://www.echoecho.com/sunset.gif' />
     </applet>"

......不起作用。也许我过度简化了小工具代码?

** 更新...我的下一次尝试如下,但仍然没有运气...

    ...
    <script src="http://java.com/js/deployJava.js"></script>
    <script>
    ...

      // end of code copied from Google's basic counter gadget...

      gadgets.util.registerOnLoadHandler(init);

      var attributes = {
        code:'http://www.....co.uk/wave/applets/DrawingLines.class',
        width:'300', 
        height:'300'} ;

      deployJava.runApplet(attributes);

    </script>

    <input type=button value="Click Me!" id="butCount" onClick="buttonClicked()">
    <input type=button value="Reset" id="butReset" onClick="resetCounter()">
  ]]> 
  </Content>
</Module>

我刚刚收到带有顶部错误的 Java 错误框:“load: class http://www.....co.uk/wave/applets/DrawingLines.class not found.”。

4

1 回答 1

1

http://jameswilliams.be/blog/entry/158似乎使用deployJava.runApplet. 这是从 2009 年 10 月开始的,所以我不知道 API 是否发生了很大变化:

<?xml version="1.0" encoding="UTF-8" ?>
<Module>http://dl.getdropbox.com/u/738191/staging/applet.html
  <ModulePrefs title="Hello Wave">
    <Require feature="wave" /> 
  </ModulePrefs>
  <Content type="html">
    <![CDATA[     
    <script>    

        function increment() {
            var num = wave.getState().get("num", 0);
            num++;
            wave.getState().submitDelta({"num":num});
        }
        function getValue() {
            return wave.getState().get("num", 0);
        } 
</script>
<script src="http://java.com/js/deployJava.js"></script>
<script>
    var attributes = {id: 'TestWave',
                      codebase:'<codebase>',
                      code:'griffon.applet.GriffonApplet',
                      archive:'griffon-rt-0.2-BETA.jar,TestWave.jar,plugin.jar,groovy-all-1.6.4.jar',
                      width:'480', height:'320'} ;
    var parameters = {fontSize:16,
                      java_arguments: "-Djnlp.packEnabled=true",
                      jnlp_href:'<codebase>/applet.jnlp',
                      draggable:'true',
                      image:'griffon.png',
                      boxmessage:'Loading TestWave',
                      boxbgcolor:'#FFFFFF', boxfgcolor:'#000000',
                      codebase_lookup: 'false'} ;
    var version = '1.5.0' ;
    deployJava.runApplet(attributes, parameters, version);
</script>
<!--       <APPLET CODEBASE='<codebase>'
        CODE='griffon.applet.GriffonApplet'
        ARCHIVE='griffon-rt-0.2-BETA.jar,TestWave.jar,plugin.jar,groovy-all-1.6.4.jar'
        WIDTH='240' HEIGHT='320'>
    <PARAM NAME="java_arguments" VALUE="-Djnlp.packEnabled=true">
    <PARAM NAME='jnlp_href' VALUE='<codebase>/applet.jnlp'>
    <PARAM NAME='dragggable' VALUE='true'>
    <PARAM NAME='image' VALUE='griffon.png'>
    <PARAM NAME='boxmessage' VALUE='Loading TestWave'>
    <PARAM NAME='boxbgcolor' VALUE='#FFFFFF'>
    <PARAM NAME='boxfgcolor' VALUE='#000000'>
    <PARAM NAME='codebase_lookup' VALUE='false'>
</APPLET-->


    ]]>
  </Content>
</Module>
于 2010-01-28T18:35:10.243 回答