The abstract windowing toolkit.

	Topics: Console, Graphics, Applet
  • The AWT provides a relatively "high level" programming toolkit for graphics that can be displayed on a variety of machine types.
  • The AWT Graphics package contains many calls that are familiar to programmers who have worked with graphics, such as drawRect and drawLinee, and it also contains simple routines for drawing images (drawImage).
  • Java programs that are run using browsers are called "applets" (little applications)
  • Applets have various premade methods, such as init, that you can "extend" (add to)
  • To send one to a browser, you must use the "applet tag":

    	<APPLET CODE="hello_java.class" WIDTH=300 HEIGHT=100>
    	Text that won't be seen if the client's browser interprets java ("sorry your browser doesn't support java")

    So, if you were to add the above code to your HTML file, and the myapp.class were in the same folder, the applet should occupy 300x100 pixels of the document.

  • A book example:

    	import java.applet.*;
    	public class hello_java extends Applet
    		public void init()
    The above code must be in a file called, and compiled to make the .class file referred to in the HTML file. What it does is simply to print the system message to the JAVA CONSOLE. That is a substitute for the "standard output." So, for example, since Macs don't have a command line, the "system" messages from an applet are sent to the Console, a shell-like window that can be opened in Netscape. PCs use a DOS window to display the console messages. Such messages can be useful to you when writing applets. If you want to see some of the data values during execution of a program, they can be printed to the console using the System.out.println method. To see the applet go to book/hello_java.html
    Other examples:
  • Hello2 (chap.3)
  • Font list (chap.4)
  • Marquee (chap.5)


  • Read Chapters 1-5
  • Compile and test the above examples
  • Hand in conference proposals