简体   繁体   English

使用 Eclipse 将小程序添加到网站

[英]Add applet to website with Eclipse

I've never really messed with Java or applets in general, but I want to start learning.我从来没有真正搞砸过 Java 或一般的小程序,但我想开始学习。 How can I take a simple app I made in eclipse and make it able to be uploaded to a website and to be used in a browser.如何获取我在 eclipse 中制作的简单应用程序并使其能够上传到网站并在浏览器中使用。 I know the question is really generic, but I really have no idea how to do this, so any help is appreciated!我知道这个问题真的很笼统,但我真的不知道如何做到这一点,所以任何帮助表示赞赏! Thanks!谢谢!

Applets are simply Java programs included in an HTML page.小程序只是 HTML 页面中包含的 Java 程序。
The HTML page contains info to inform the browser which applet to load and where to place it inside a web page. HTML 页面包含通知浏览器要加载哪个小程序以及将其放置在 web 页面内的位置的信息。
Eg例如

In `applet.html`
<applet code="SomApplet.class" width="300" height="300">
</applet>

A java application (specifically a Swing application) can be turned into an applet.可以将 java 应用程序(特别是 Swing 应用程序)转换为小程序。
You have to extend JApplet and implement init .您必须扩展JApplet并实现init
So broadly speaking, modify your swing application you created in Eclipse to extend a JApplet, and create the required code tags.宽泛地说,修改您在 Eclipse 中创建的 swing 应用程序以扩展 JApplet,并创建所需的代码标签。
For more help you should post your application code如需更多帮助,您应该发布您的应用程序代码

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

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