我可以在 Google Wave 小工具中嵌入 Java 小程序吗?

发布于 2024-08-20 04:30:10 字数 1292 浏览 5 评论 0原文

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

我猜我不能,因为使用以下内容嵌入小工具中的小程序......

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 未找到。”。

If so, can someone point me in the direction of an example? Or even some code?!

I'm guessing that I can't as the applet embedded in a gadget using the following...

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>"

... doesn't work. Maybe I'm over-simplifying the gadget code?

** UPDATE...
My next attempt was the following, and still no luck...

    ...
    <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>

I just get Java error box with the top error: "load: class http://www.....co.uk/wave/applets/DrawingLines.class not found.".

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深海里的那抹蓝 2024-08-27 04:30:10

http://jameswilliams.be/blog/entry/158 似乎可以使用 部署Java.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>

http://jameswilliams.be/blog/entry/158 appears do accomplish this using deployJava.runApplet. This was from October 2009, so I don't know if the API has changed much:

<?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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文