// addWindowListener(new WindowAdapter() { // public void windowClosing(WindowEvent e) { // dispose(); // System.exit(0); // } // });
System.out.println("Starting PolyMorphism..."); PolyMorphism mainFrame = new PolyMorphism(); mainFrame.setSize(400, 400); mainFrame.setTitle("PolyMorphism"); mainFrame.setVisible(true);
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);