简体   繁体   English

如何将java swing applet嵌入到网站中?

[英]How do I embed a java swing applet into a website?

I am trying to embed a swing applet into our website, but it is not working. 我正在尝试将一个swing applet嵌入到我们的网站中,但它无法正常工作。 I have been able to get applets that use awt to do graphics to work. 我已经能够获得使用awt进行图形处理的applet。 The web page that contains the applet only shows a blank box that should contain my applet, there aren't even any error messages. 包含applet的网页只显示一个应包含我的applet的空白框,甚至没有任何错误消息。 My applet works fine in netbeans. 我的applet在netbeans中运行良好。 The applet is supposed to show a few buttons and a text field. applet应该显示几个按钮和一个文本字段。 I really don't know whats going on. 我真的不知道发生了什么事。

The web page is located at http://nuevawave.org/sandbox/JavaGallery/GUIApplet.html The applet is at http://nuevawave.org/sandbox/JavaGallery/TestApplet.jar 该网页位于http://nuevawave.org/sandbox/JavaGallery/GUIApplet.html该小程序位于http://nuevawave.org/sandbox/JavaGallery/TestApplet.jar

Here is the html: 这是html:

    <html>
       <head>
          <title>Test Page</title>
          <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
       </head>
       <body>
           <applet Archive ="TestApplet.jar, swing-layout-1.0.4.jar"
                  Code="test.GUIApplet"
                  WIDTH="250" HEIGHT="300" >
           </applet>

       </body>
   </html>

as I wrote in the comments it works for me (I'm using OpenJDK 1.6.0_22, Linux (ubuntu) and Firefox). 正如我在评论中写的那样,它适用于我(我正在使用OpenJDK 1.6.0_22,Linux(ubuntu)和Firefox)。

If java works from your "command line" or terminal. 如果java从您的“命令行”或终端工作。 I could be that the plugin for your browser isn't installed. 我可能是你的浏览器插件没有安装。 I would recommend you reinstalling the JDK or JRE and remember to install the plugin for the browser aswell. 我建议你重新安装JDK或JRE,并记得为浏览器安装插件。

You can use the <object> tag instead. 您可以改用<object>标签。 To know how to use this, check this link 要了解如何使用此功能,请查看此链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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