A simple drawing routine

  • Java has a "paint" method that is invoked when the applet starts and when the browser window is resized
  • The paint method is invoked by the browser
  • The paint method has an incoming variable of type Graphics
  • You can invoke methods of the Graphics class within the paint function
  • An example is the shapes.class, which draws a rectangle within the paint method
  • The source for the shapes.java is here and the html page contains:
    	<applet code="shape.class" height=100 width=200>

    A graph application

  • You can use Java to visualize data
  • browser stats can be generated from the httpd logs and converted into graphical information
  • The html for this demo is created with browser.cgi
    	This means that its data is generated 
    	dynamically using cgi, rather  than a 
    	static parameterized page like 
  • The source for this applet is here


  • Read chapters 6, 7
  • Experiment with some of the methods introduced in the first few chapters.