Swing Application Run In Web Browser
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.
if you wish the application to run in its own window, just write applet that calls
YourApplication.main()
from its methodstart()
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.
精彩评论