/********
 *
 * GraphicsDemo
 * 
 * A sample of drawing lines, rectangles, and text to a window.
 * See chapter 6 in King's book.
 *
 * -- DO NOT -- run this remotely on akbar; 
 * it'll only work if the java program is running on
 * the same computer that can display things on your screen.
 *
 * The window itself is handled by the routines that King wrote,
 * in his "jpb" package.
 *
 **********/

import java.awt.*;
import jpb.*;

class GraphicsDemo {

    public static void main(String[] args){

	DrawableFrame df = new DrawableFrame("Graphics Demo");
	df.show();
	df.setSize(200,200);
	
	Graphics g = df.getGraphicsContext();

	g.setColor(Color.yellow);
	g.fillRect(0,0,200,200);

	g.setColor(Color.red);
	g.drawLine(50,50,100,100);

	g.setColor(Color.green);
	g.drawRect(110,50,20,30);
	g.fillRect(30,150,80,10);

	g.setColor(Color.magenta);
	g.fillOval(40,10,30,20);

	g.setColor(Color.blue);
	Font f = new Font("SansSerif", Font.BOLD, 24);
	g.setFont(f);
	g.drawString("Hey.", 120,160);

	df.repaint();
	
    }

}


syntax highlighted by Code2HTML, v. 0.9.1