/** * Lake.java * * @author David Tran * @version 1.0 */ package background; import java.awt.Graphics2D; import java.awt.Color; import java.awt.Stroke; import java.awt.BasicStroke; import java.awt.Point; import java.awt.geom.*; /** * A background representing a lake */ public class Lake extends Background { /** * Initialize attributes for this Lake * * @param x x-coordinate of this Lake (leftmost position of background) * @param y y-coordinate of this Lake (uppermost position of background) * @param w width of this Lake * @param h height of this Lake */ public Lake(double x, double y, double w, double h) { super(x, y, w, h); super.externalName = "Lake"; } /** * Use the graphics system to draw the shapes representing this Lake * * @param g the graphics system to use */ public void draw(Graphics2D g) { g.setPaint((Color.BLUE)); g.fill(new Ellipse2D.Double(xCoor, yCoor, width, height)); g.fill(new Ellipse2D.Double(xCoor+width/2, yCoor+height/2, width, height)); g.fill(new Ellipse2D.Double(xCoor+width/4, yCoor+height/4, width, height)); g.fill(new Ellipse2D.Double(xCoor+width/8, yCoor+height/8, width, height)); g.fill(new Ellipse2D.Double(xCoor+width/16, yCoor+height/16, width, height)); g.fill(new Ellipse2D.Double(xCoor+width*3/8, yCoor+height*3/8, width*.75, height*.75)); g.fill(new Ellipse2D.Double(xCoor+width*7/16, yCoor+height*7/16, width*1.1, height*1.1)); } }