How can I change my application into applet?
It really depends on the type of application you have and if you still need to run the converted applet as an application.
If the application is not graphical, then your new applet would just be a graphical frontend to execute it. Depending upon what the application needed to do, that might involve actually executing something on the server, as applets have security restrictions. You would need to develop the communication infrastructure to support this. For instance, a chat application run as an applet would require some kind of a proxy-like server on the web server to redirect the chats between different users running applets.
If the application needs support files, like images or audio files, how to get these tends to be different between applets and applications. It is best to get these as resource files [getResource()/getResourceAsStream()] from both applications and applets then try to do things differently between the two. And, keep in mind that applets can only get them from the web server from which the applet came, not a third-party server which the application would be able to communciate with.
So, a rough set of steps to do the conversion would be as follows:
- Create a subclass of java.applet.Applet
- Take the code in the main() method of the application and move it to the init() method of the applet
- Create an HTML file to load the applet
- If necessary, move any requirements that untrusted applets cannot do into an appropriate server-side task
- If necessary, modify all getting of support files