java 如何在 Web 浏览器上部署 Swing 应用程序?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14979140/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 18:04:34  来源:igfitidea点击:

How to deploy swing application on web browser?

javaswingbrowserjframewebswing

提问by wanda

I have a big swing application that I have developed. There are several classes that each creates its own JFramewhile closing the previous one which called this class.

我有一个我开发的大型摇摆应用程序。有几个类,每个类都创建自己的JFrame,同时关闭前一个称为此类的类。

I wish to deploy this into a web browser and understand that I need to convert it to an applet. Do I have to add in code for creating applet in each of these classes? or is there some other way.

我希望将其部署到 Web 浏览器中,并了解我需要将其转换为小程序。我是否必须添加用于在每个类中创建小程序的代码?或者有其他方法。

In my current situation each of the class creates a JFramewhich has some buttons which on being clicked will close the current JFrameand instantiate a new class which creates another JFrame.

在我目前的情况下,每个类都会创建一个JFrame,其中有一些按钮,单击这些按钮将关闭当前JFrame并实例化一个新类,该类创建另一个JFrame

Could you please help me and advice me on how to resolve my problem?

你能帮助我并建议我如何解决我的问题吗?

回答by Oleksii Kyslytsyn

I have just used below steps:

我刚刚使用了以下步骤:

  1. Download Webswingfrom http://webswing.org/
  2. Upload your jar file
  3. Add your application to webswing.configand use Java 8+
  4. Start Webswing server and the added application swing window will appear in your browser at http://localhost:8080/by default
  1. http://webswing.org/下载Webswing
  2. 上传你的 jar 文件
  3. 添加您的应用程序webswing.config并使用 Java 8+
  4. 启动 Webswing 服务器,添加的应用程序 Swing 窗口将默认出现在您的浏览器中,地址为http://localhost:8080/

回答by splungebob

Look into Java Web Start. This enables you to launch a Swing app from the web without changing a thing.

查看Java Web Start。这使您可以从 Web 启动 Swing 应用程序,而无需更改任何内容。

回答by ArulRaj G

  1. Download creamtec.com-->AjaxSwing application
  2. Install this application in your system
  3. configure java in SetEnv.sh file and also configure the Ajaxswing application path
  4. Presently ajaxswing application launched.
  5. AjaxSwing > webapps > lib > paste your jar file and related images also
  6. To create configure file in Ajaxswing > config > this configure file name should be same on your package name
  7. run ajaxswing application
  8. select new
  9. type project name
  10. add related lib file (The all related jar connectors and jar files)
  11. type packagename.mainclass
  12. run server
  13. The system display the url and also launch in ie
  1. 下载 creamtec.com-->AjaxSwing 应用程序
  2. 在您的系统中安装此应用程序
  3. 在 SetEnv.sh 文件中配置 java 并配置 Ajaxswing 应用程序路径
  4. 目前 ajaxswing 应用程序启动。
  5. AjaxSwing > webapps > lib > 也粘贴你的 jar 文件和相关图像
  6. 在 Ajaxswing > config > 中创建配置文件,这个配置文件名应该与你的包名相同
  7. 运行 ajaxswing 应用程序
  8. 选择新的
  9. 输入项目名称
  10. 添加相关的 lib 文件(所有相关的 jar 连接器和 jar 文件)
  11. 输入包名.mainclass
  12. 运行服务器
  13. 系统显示 url 并在 ie 中启动