Adistributed application is several programs collaborating to solve the same problem (running on the same computer or different computers connected by a network). The most popular types of distributed applications are client-server applications. In a client-server application certain programs are designated as servers, while others are clients. Clients request services from the servers. Servers are often multi threaded programs that spawn threads to service client requests. File and database servers are early examples of servers.

World Wide Web (WWW)
WWW is an example of a client-server application. Web servers manage collections of web pages (HTML files). Web clients (browsers) request and display web pages:

A browser identifies the web page it wants using a Universal Resource Locator (URL). A URL has the form:
HTML "Review"
A web page is a text file that uses the hyper text markup language (HTML) to describe what a browser should display. Here is the contents of a file called planets.html:

HTML Elements
Besides text, html files can contain other elements. An element usually appears between two tags:
images
http://www.utoronto.ca/webdocs/HTMLdocs/NewHTML/htmlindex.html
The Applet-Servlet Framework
Sometimes the common features of a family of similar applications can be extracted and placed in a framework, which can then be customized to create different applications in the family. Typically, a framework is a library of related base classes which is customized by extension.
Java has created a framework for the client-server application family. Applet is the base class for all clients, and Servlet is the base class for all servers. The WWW is such a generic client-server application, that Applets piggy back on top of Applet-enabled web clients, and Servlets piggy back on top of Servlet-enabled web servers:

We will not discuss servlets, because we don't have access to a web
server with a servlet engine, and servlets aren't part of JDK. If your
interested, visit: http://java.sun.com/products/servlet/index.html
Applets
Recall that a panel is a borderless container. An applet is a special type of panel:
Security Rules
People naturally feel uncomfortable downloading and running programs. The dangers of viruses, worms, and Trojan horses are quite real. To combat these worries, Java enforces some rules regarding what Applets can and can't do. Different browsers may also add some rules. Basically, applet can't:
communicate with any computer
other than the originating host
read or write to the local file
system
gather information about the
local host except for Java version, type of OS, and file separator character
used (/ or \)
pop up windows that don't carry
warnings
Recall the mouse drawing application discussed earlier. Drawlet is essentially an applet version of the same program.
appletViewer version
The applet viewer is a tool that allows you to test your applets. Here are the commands I used:

Netscape 4.5 Version

You can try this out yourself if you have a modern version of Netscape.
Click
here.
Drawlet.java
Here's the code:
public class Drawlet extends
Applet
{
private Vector
drawing; // points in drawing
private int brushWidth;
// diameter of circle
private int red,
green, blue; // color of circle
AppletContext
context;
Frame myFrame;
public void init()
{
addMouseMotionListener(new MouseMotionHandler());
addMouseListener(new MouseEventHandler());
drawing = new Vector();
brushWidth
= Tools.toInt(getParameter("brushWidth"));
red = Tools.toInt(getParameter("red"));
green = Tools.toInt(getParameter("green"));
blue = Tools.toInt(getParameter("blue"));
context = getAppletContext();
//
search ancestors in the component hierarchy until a frame is found
Object parent = getParent();
while (!(parent instanceof Frame))
parent = ((Component) parent).getParent();
myFrame = (Frame) parent; // EmbeddedAppletFrame in Netscape?
}
class MouseMotionHandler
implements MouseMotionListener
{
public void mouseMoved(MouseEvent e) { }
public void mouseDragged(MouseEvent e)
{
myFrame.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
Point p = e.getPoint();
drawing.addElement(p);
showStatus("Dragging");
// to prevent flicker, only repaint a small rectangle
repaint(p.x, p.y, brushWidth, brushWidth);
}
}
class MouseEventHandler
extends MouseAdapter
{
public void mouseClicked(MouseEvent e)
{
if (e.getClickCount() > 1)
{
drawing.removeAllElements();
repaint(); // repaint entire window
}
}
public void mouseReleased(MouseEvent e)
{
myFrame.setCursor(Cursor.getDefaultCursor());
showStatus("");
}
}
public String getAppletInfo()
{
String about =
"Author: J. Pearce";
about += ", version
1.0";
return about;
}
public void paint(Graphics
g)
{
g.setColor(new Color(red, green, blue));
for(int i = 0; i < drawing.size(); i++)
{
Point p = (Point)drawing.elementAt(i);
g.fillOval(p.x, p.y, brushWidth, brushWidth);
}
}
} // Drawlet
Applets are embedded in web pages like any other element, only using applet tags: <APPLET ... > ... </APPLET>