tags:

views:

140

answers:

5

What is the difference between applets and SWING?

+4  A: 

See Applets

An applet is a program written in the Java programming language that can be included in an HTML page, much in the same way an image is included in a page. When you use a Java technology-enabled browser to view a page that contains an applet, the applet's code is transferred to your system and executed by the browser's Java Virtual Machine (JVM).

See Swing (Java)

Swing is a widget toolkit for Java. It is part of Sun Microsystems' Java Foundation Classes (JFC) — an API for providing a graphical user interface (GUI) for Java programs.

Swing was developed to provide a more sophisticated set of GUI components than the earlier Abstract Window Toolkit. Swing provides a native look and feel that emulates the look and feel of several platforms, and also supports a pluggable look and feel that allows applications to have a look and feel unrelated to the underlying platform.

rahul
Note that you can create an applet with Swing by extending the JApplet class.
R. Bemrose
+1  A: 

An applet is a small program that often runs in a web browser Java plugin.

A swing is a piece of playground equipment usually consisting of a seat suspended by two chains or ropes. It's quite fun. :)

In all seriousness, though, Swing is a Java GUI library. It provides components such as buttons and text fields. You can use Swing components in an applet.

Jeff
A: 

Applets will be downloaded at the client web browser and executed locally where as swing has a set of APIs for developing GUI components and can act as stand alone applications.

adsk
A: 

Short answer: Applets are intended to be small bits of functionality run in a web browser and downloaded on-demand. Swing is a collection of user interface components, like text boxes and windows, that are meant to be assembled by a developer for use on the desktop.

Long answer: See adamantium's answer.

spork
A: 

I think the confusion is with all the terminology you initially encounter when building applets.

Applet is the overall name for a programme that runs in a Java sandbox in a web browser. It is also a specific Java class (java.applet.Applet). The entry class of this programme must extend Applet.

Applets originally (upto Java version 1.1) could only use AWT user interface components.

Since Java version 1.3 Swing components may be used instead. In this case your entry class must extend JApplet.

Pool