FileDocCategorySizeDatePackage
DrawShape.javaAPI DocExample1306Sun Nov 25 21:00:48 GMT 2001myprojects.drawshape

DrawShape.java

/*
 * @(#)DrawShape.java 1.0 01/11/25
 *
 * You can modify the template of this file in the
 * directory ..\JCreator\Templates\Template_1\Project_Name.java
 *
 * You can also create your own project template by making a new
 * folder in the directory ..\JCreator\Template\. Use the other
 * templates as examples.
 *
 */
package myprojects.drawshape;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

class DrawShape extends JFrame {
	// Create a circle to be drawn at 100,100, with a radius 80
	Circle c = new Circle(100,100,60);
	// create a triangle to be drawn at 100,100 with opposite=100 and adjacent = 50
	Triangle t = new Triangle(50,50,100.0,50.0);
	public DrawShape() {
		addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent e) {
				dispose();
				System.exit(0);
			}
		});
		// Add the canvases to the layout
		Container contents = getContentPane();
		c.setSize(200,200);
		t.setSize(200,200);
		contents.add(c,"North");
		contents.add(t,"South");
		pack();
		
	}

	public static void main(String args[]) {
		System.out.println("Starting DrawShape...");
		DrawShape mainFrame = new DrawShape();
		mainFrame.setSize(400, 500);
		mainFrame.setTitle("DrawShape");
		mainFrame.setVisible(true);
		
	}
}