开发者

Swing Application Run In Web Browser

开发者 https://www.devze.com 2023-01-28 17:19 出处:网络
I Have Create a One Swing Application and I Want To Run My Swing Application In To My Local Web Browser So Plz Tell Me How Can I Do This Because For Applet Program There Is No Any Longer Process For T

I Have Create a One Swing Application and I Want To Run My Swing Application In To My Local Web Browser So Plz Tell Me How Can I Do This Because For Applet Program There Is No Any Longer Process For Th开发者_StackOverflow中文版is.


Browsers do not know to run applications. They run applets.

There are 2 ways to refactor you application.

  1. if you wish the application to run in its own window, just write applet that calls YourApplication.main() from its method start()

  2. If you wish to see your application into the browser's window (as a part of your web page) you have to create applet (that extends Pannel), set its layout to BorderLayout and then put the main panel of your application into center of applet. That's it.

If you do not have one panel that contains all elements, e.g. you are adding all elements directly to JFrame you have to fix your application. Create one main panel, add all elements there and put this panel to the center of your JFrame.

0

精彩评论

暂无评论...
验证码 换一张
取 消