uni

Thing1's amazing uni repo
Log | Files | Refs

Square.java (436B)


      1 import java.awt.*;
      2 import java.awt.geom.*;
      3 
      4 class Square extends Shape {
      5 	private int w, h;
      6 
      7 	public String toString() {
      8 		return "width: " + w +
      9 			", heigth " + h +
     10 			", " + super.toString();
     11 	};
     12 
     13 	public void draw() {
     14 		if (super.getVisible()) {
     15 			Canvas canvas = Canvas.getCanvas();
     16 			canvas.draw(this, super.getColor(), 
     17 					(Shape) new Rectangle2D.Double(
     18 						super.getX(),
     19 						super.getY(),
     20 						w,
     21 						h));
     22 
     23 		}
     24 	}
     25 }