/* **************************************************************************** * Kelli Wiseth * kelli@alameda-tech-lab.com * CIS 255AX * Program name: MyLine.java * Program Description: The superclass for a simple class hierarchy of shapes. * * * Assignment #4 * 29 March 2005 **************************************************************************** */ import java.awt.*; public class MyLine { // a line needs a beginning point and an ending point private Point beginPoint, endPoint; public MyLine(){ beginPoint = new Point(0,0); endPoint = new Point(0,0); } public MyLine(int x1, int y1, int x2, int y2){ beginPoint = new Point (x1, y1); endPoint = new Point (x2, y2); } public int getBeginPointX(){ return beginPoint.getX(); } public int getBeginPointY(){ return beginPoint.getY(); } public int getEndPointX(){ return endPoint.getX(); } public int getEndPointY(){ return endPoint.getY(); } public void setBeginPoint(int x1, int y1){ beginPoint = new Point(x1, y1); } public void setEndPoint(int x2, int y2){ endPoint = new Point(x2, y2); } public void draw( Graphics g){ g.drawLine(getBeginPointX(), getBeginPointY(), getEndPointX(), getEndPointY()); } }