Swing is light weght Component. Applet is heavy weight Components
Swing Using UIManager. Swing have look and feel according to user view u can change look and feel. Applet Does not provide this facility
Swing uses for stand lone Applications ,Swing have main method to execute the program. Applet need HTML code for Run the Applet
Swing uses MVC Model view Controller. Applet not
Swing have its own Layout ..like most popular Box Layout Applet uses Awt Layouts..like flowlayout
Swing have some Thread rules. Applet doent have any rule.
To execute Swing no need any browser By which we can create stand alone application But Here we have to add container and maintain all action control with in frame container. To execute Applet programe we should need any one browser like Appletviewer,web browser. Because Applet using browser container to run and all action control with in browser container.
- Heavy weight components (created by the native operating system)
- More time for creation
- Blocky look and feel
Swing
- Light weight components (created by JVM using Java class libraries)
- Faster creation time
- Modern look and feel
Main draw back of AWT components over Swing is, each AWT component has its own look and feel in every operating system. So, to get same look and feel across multiple operating systems, go for Swing components.
Applets are Gui-Applications that can be run using a webbrowser-plugin or another appletviewer. They are developed subclassing Applet or JApplet (a class of the swing-library). They can override more than a single application entry point: init(), start(), destroy(), ... Normally a webbrowser will be used and the applet is embedded in a webpage.
Swing is a class library that can be used to develop desktop-applications and applets. Swing-Desktop-Applications will have an application-entry-point public static void main(String[] args) that uses SwingUtitlies' static method invokeLater(...) to create the gui and a event-dispatch-thread.
- running it from a Web browser, for it we need to create an HTML file so it can be visualized from Web browser,
We can compare SWING with AWT. We could extend Applet from AWT package too, but SWING (JAPPLET) provides a more modern set of graphical user interface (GUI) components.
To create an APPLET , we create a class that extend JApplet from SWING package. Of course, we could extend APPLET from AWT package , but it is out of date.
Please see my et.al paper from RG "Scientific Information Repository ...."
Applet is heavy weight (into system) container, that can be composed of light weight (into java virtual mashine) swing components. JApplet class is a swing superstructure that mask differences between heavy weight Applet and light weight swing container.
If i may add it will be divide into two like before:
Desktop Gui-stand alone
-Awt is the oldest tool to create feel and look gui that have a problem.
-swing is most generic and better than awt,but having problem with performance.
-SWT build by ibm to overcome problem with swing with better performance but use only by eclipse with its problem
-swingX,overcome swing problem and swt compatibility problem.
For web apps
-Applet, use for client side of java web base application but having problem of need to dowwnload each time its use.its good for small network as intranet but will have problem over internet where so manh host request to run the apps.
-servlet,use for server side of java web base apps have difficulties in development since it need to be compile but doesnt have problem with download since its run on server it can handle multiple request.
-jsp, almost look like servlet but easier to develop since it doesnt need to be compile as it use html style of client side as applet.