FileDocCategorySizeDatePackage
PolyMorphism.javaAPI DocExample1114Fri Nov 09 18:52:24 GMT 2001polymorphism

PolyMorphism

public class PolyMorphism extends JFrame

Fields Summary
Constructors Summary
public PolyMorphism()

	//	addWindowListener(new WindowAdapter() {
//			public void windowClosing(WindowEvent e) {
//				dispose();
//				System.exit(0);
//			}
//		});
	
Methods Summary
public static voidmain(java.lang.String[] args)

		System.out.println("Starting PolyMorphism...");
		PolyMorphism mainFrame = new PolyMorphism();
		mainFrame.setSize(400, 400);
		mainFrame.setTitle("PolyMorphism");
		mainFrame.setVisible(true);
	
public voidpaint(java.awt.Graphics g)

		Shape s[] = new Shape[2];
		Circle c = new Circle();
		Square sq = new Square();
		s[0] = c;
		s[1] = sq;
		s[0].drawShape(g,100,100,200,200);
		s[1].drawShape(g,200,200,100,100);