Can Swing be used in web-based application?
Hi,
I have a swing destop application, where I have arranged the swing components using JPanel, JFrames... Is it possible to use the same JPanel items in the web application? This is to reuse the screens in web application which was actually created for Desktop application.
I would be grateful if I get any pointers to reuse the JPanel items in the web which was created for desktop application.
..Thiruppathy.R
# 1
That depends. You can convert your application to run as an applet, possibly fairly easily. Then it'd be embedded in a web page, and could connect to the server via HTTP or some other way.
But that's not a true "web application", as it's come to mean. In which case the answer is no. You could probably reuse parts on a server side within JSP or J2EE, but the Swing code would not be part of the presentation.
# 2
Thanks for your reply.
So, the only way to use the existing swing components, is to put them into the JApplet container and include the applet with the html page. Could you correct me if I am wrong.
>>>You could probably reuse parts on a server side within JSP or J2EE, but the Swing code would not be part of the presentation.
Does it mean that we can reuse only the second level (next tier) of service which serves the data information and manipulation, but not the UI controls and events parts?
..Thiruppathy.R
# 3
> So, the only way to use the existing swing
> components, is to put them into the JApplet container
> and include the applet with the html page. Could you
> correct me if I am wrong.
Correct. Usually "web application" is just HTML based accessed via a web/application server. The Swing components need something to live in on the user's side.
> >>>You could probably reuse parts on a server side
> within JSP or J2EE, but the Swing code would not be
> part of the presentation.
>
> Does it mean that we can reuse only the second level
> (next tier) of service which serves the data
> information and manipulation, but not the UI controls
> and events parts?
Correct. Running the swing UI on the server side would only show on the server, not the client side. Unless you do the applet route.
# 5
Of course, WebStart is kinda a cross between applet and application, launched (at least initially) via a web page link.If your desktop application already just only talks to a server, then using it as an applet or with WebStart would be a fairly simple conversion.