xonecas.io
101
Sh

shapesaver / files

shapesaver / MyBoundedShape.java

1.1 KB
1/*
2   sean caetano martin
3   seancaetanomartin@gmail.com
4   CIS 255 HY
5   MyBoundedShape.java abstract superclass
6   assignment#5
7   3/28/11
8*/
9
10import java.awt.Color;
11import java.awt.Graphics;
12
13public abstract class MyBoundedShape extends Shape
14{
15	private boolean filled;
16
17	//default contructor
18	public MyBoundedShape ()
19	{
20		super();
21	}//end default contructor
22
23	// constructor
24	public MyBoundedShape (int x1, int y1, int x2, int y2, Color color, Boolean fill)
25	{
26		super (x1,y1,x2,y2,color);
27		setFilled(fill);
28	}//end contructor
29
30	// getUpperLeftX
31	public int getUpperLeftX ()
32	{
33      return getX1();
34   }
35
36	// getUpperLeftY
37	public int getUpperLeftY ()
38	{
39      return getY1();
40   }
41
42	// getWidth
43	public int getWidth ()
44	{
45      return Math.abs(getX1() - getX2());
46   }
47
48	// getHeight
49	public int getHeight ()
50	{
51      return Math.abs(getY1()- getY2());
52   }
53
54	// isFilled
55	public boolean isFilled ()
56	{
57      return filled;
58   }
59
60	// setfilled
61	public void setFilled (boolean fill)
62	{
63      filled = fill;
64   }
65}//end MyBoundedShape