|
|
CLIENT applications | applets | awt | javabeans | swing
Last updated: April 2003
Java was popularized by Sun in 1995 when it released alpha and beta
versions of the Java Development Kit (JDK). In addition to normal
applications, developers could create
little programs called applets which could be
embedded in a web page and run inside the browser window of the new
Netscape Navigator 2.0.
As interest in Java grew, developers started trying to create full-blown
graphical applications on the client — the initial graphical components
comprising AWT were too primitive, so Sun created a much better
toolkit called Swing. It also introduced a component
framework to promote reusability, JavaBeans.
|
|
|
applications
An application is a typical Java program (client-side or server-side)
consisting of a set of related classes, with each one usually
being coded in a separate file. Classes can be grouped into
packages and arranged in a hierarchical directory structure on
disk. (This hierarchical
structure is independent of the object hierarchy based on inheritance.)
As in C++, one file includes a main()
function, allowing it to be invoked on the command-line and making
it an entry-point for the application.
Here is some sample Java code, containing a class
for printing the current date and time:
RESOURCES
LucidDoc — a GUI application I have built.
Links
to some Java applications
|
| APPLET TEXTSCROLL REQUIRES COMMUNICATOR OR IE 4. | applets When Sun started popularizing Java in 1995, applets (considered distinct from applications) were a key part of the strategy for enticing developers. Applets, little Java programs run in a browser window, gave early life to the dream of making the incipient Web an interactive network OS. Netscape and Microsoft, competing to make their browsers as feature-rich as possible, both included Virtual Machines to run Java programs in early versions of their browsers. Due to various problems with reliability applets failed to catch on, and are now considered largely irrelevant to the progress of Java. An applet has a lifecycle defined in its mandatory superclass, java.applet.Applet: the chief callback methods which may be implemented by the programmer are:
RESOURCES |
|
|
awt The AWT is the basic Java GUI toolkit including classes for the essential controls used in a graphical application: frames, buttons, labels, select lists (Choice and List), text fields, text areas, scrollbars, menus, checkboxes etc. The Canvas class allows general line drawing, but you have to get a Graphics object — fonts and colors are associated with the graphical context. All the GUI elements are subclassed under the Component class. One of the subclasses of Component is the Container class. Containers are graphical elements like panels or windows that hold other graphical elements. To place an element at a particular place in a container it is necessary to first specify a layout manager using setLayout and then use add. In other words elements are placed relative to each other rather than at specific coordinates. There are different layout managers provided: the most complex is GridBagLayout. RESOURCES Lissajous Curves Example — version of the graphical pattern generator shown at the top of the Overview page, but with controls. I got the basic algorithm from the book Computers and the Imagination by the graphical mathematician Pickover. |