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
How to deploy swing application on web browser?
提问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:
我刚刚使用了以下步骤:
- Download Webswingfrom http://webswing.org/
- Upload your jar file
- Add your application to
webswing.config
and use Java 8+ - Start Webswing server and the added application swing window will appear in your browser at http://localhost:8080/by default
- 从http://webswing.org/下载Webswing
- 上传你的 jar 文件
- 添加您的应用程序
webswing.config
并使用 Java 8+ - 启动 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
- Download creamtec.com-->AjaxSwing application
- Install this application in your system
- configure java in SetEnv.sh file and also configure the Ajaxswing application path
- Presently ajaxswing application launched.
- AjaxSwing > webapps > lib > paste your jar file and related images also
- To create configure file in Ajaxswing > config > this configure file name should be same on your package name
- run ajaxswing application
- select new
- type project name
- add related lib file (The all related jar connectors and jar files)
- type packagename.mainclass
- run server
- The system display the url and also launch in ie
- 下载 creamtec.com-->AjaxSwing 应用程序
- 在您的系统中安装此应用程序
- 在 SetEnv.sh 文件中配置 java 并配置 Ajaxswing 应用程序路径
- 目前 ajaxswing 应用程序启动。
- AjaxSwing > webapps > lib > 也粘贴你的 jar 文件和相关图像
- 在 Ajaxswing > config > 中创建配置文件,这个配置文件名应该与你的包名相同
- 运行 ajaxswing 应用程序
- 选择新的
- 输入项目名称
- 添加相关的 lib 文件(所有相关的 jar 连接器和 jar 文件)
- 输入包名.mainclass
- 运行服务器
- 系统显示 url 并在 ie 中启动