/* **************************************************************************** * 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 #6 * 26 April 2005 **************************************************************************** */ import java.awt.*; import java.awt.geom.*; public class MyLine implements MyShape { private Point beginPoint, endPoint; public MyLine(){ beginPoint = new Point(); endPoint = new Point(); } public MyLine(int x1, int y1, int x2, int y2){ beginPoint = new Point (x1, y1); endPoint = new Point (x2, y2); } 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 Point getBeginPoint() { return beginPoint; } public Point getEndPoint() { return endPoint; } public void draw( Graphics g){ Graphics2D g2d = (Graphics2D)g; g2d.draw(new Line2D.Double(beginPoint.getX(), beginPoint.getY(), endPoint.getX(), endPoint.getY())); } } // MyLine