/*
****************************************************************************
*  Kelli Wiseth
*  kelli@alameda-tech-lab.com
*  CIS 255AX
*  Program name: MyTriangle.java
*  Program Description: The subclass of MyLine that creates triangles. The 
*     points from MyLine are inherited and used to create two of the three
*     lines in the triangle. The third point is a private member of the
*     MyTriangle class. 
*
*  Assignment #6
*  26 April 2005
****************************************************************************
*/
import java.awt.*;
import java.awt.geom.*;

public class MyTriangle extends MyLine {

    private Point point;

    //the default constructor (with no args that sets all coordinates to 0)
	
	public MyTriangle(){
        super();
        point = new Point();
	}
	
    public MyTriangle(int x1, int y1, int x2, int y2, int x3, int y3){
		super(x1, y1, x2, y2);
		point = new Point(x3, y3);
	}
 
    public int getPointX(){
   	   return point.getX();
    }
    
    public int getPointY(){
       return point.getY();
    }
 
    public void setPoint(int x3, int y3){
   	   point = new Point(x3, y3);
    }

    /********************************************************************
     * The draw method overrides the draw() method in the MyLine class. We're 
     * able to call the inherited methods of MyLine directly to draw the
     * lines that comprise the triangle.
     ********************************************************************
     */
    public void draw( Graphics g){
    	   int xValues[] = {getBeginPoint().getX(), getEndPoint().getX(), getPointX()};
    	   int yValues[] = {getBeginPoint().getY(), getEndPoint().getY(), getPointY()};
    	   g.fillPolygon(xValues, yValues, 3);
   }
} // MyTriangle