Hi Guys : I was going to deploy a complex web app (includes a visualization tool, external communication with databases via JDBC/hibernate, multiple large linked eclipse projects, etc...) into an applet that can be run from a web page.
Is this possible ? I want a click and run, web embedded app, and the whole thing is done in swing so i figured it wouldnt be hard...
Please let me know. Im worried that after packaging it into an applet something will break or not work. !
Technically it's possible. A JApplet has a lot of similarities with a JFrame, including the root pane and support for a JMenuBar.
There are some things you need to think about though:
A JApplet (and Applet) is not a top-level window. So any code you have for showing modal dialogs will have to be changed. You can use the code below for finding the Frame object in which the applet is located. This object actually represents the browser window; it's class will not be Frame.class or JFrame.class but some subclass of Frame.
You will have to sign the applet or it will only have access to the server it's downloaded from. Uses will then have to accept your certificate or it won't run.
Stopping the application from being closed will not be possible for as far as I know.
Shutdown hooks are not guaranteed to run or complete.
There are some more limitations but I can't think of them right now.
As for the code: This code is a bit more generic so you can call it for any type of component. In this case, you need to call it as
[ November 04, 2008: Message edited by: Rob Prime ]
Also, 2-tier applets have to be signed, I believe. The standard applet sandbox rules don't permit JDBC.
If it's a really complex app - something on the scale of ArgoUML, for example, it might be better to implement it as an application instead of an applet and use JNLP to download it. This is especially true if you intend to deploy outside a LAN (on the open Internet).
Also, returning to the 2-tier theme, apps and applets on the open Internet can encounter filewall problems when using JDBC. And should. 2-tier apps are how the SQL Slammer worm managed to wreak so much havoc.
"privilege" comes from the Latin words for "private" and "law" (legal) and dates to feudal times. To "claim privilege" meant that you were above the laws that applied to the common people.
I have a demonstration system of 3-tier Java Applet on the Internet, which uses JDBC. It uses remote procedure calls by Spring Framework Remoting. It is slow initially because of download of jar files and compile.