Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- /**
- * Write a description of class Heptagon here.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class Heptagon extends SuperClass
- {
- // instance variables - replace the example below with your own
- private int height;
- private int width;
- /**
- * Constructor for objects of class Heptagon
- */
- public Heptagon()
- {
- xPosition = 50;
- yPosition = 15;
- height = 30;
- width = 50;
- color = "red";
- isVisible = false;
- }
- /**
- * An example of a method - replace this comment with your own
- *
- * @param y a sample parameter for a method
- * @return the sum of x and y
- */
- public void draw()
- {
- super.draw();
- if(super.isVisible) {
- Canvas canvas = Canvas.getCanvas();
- int[] xpoints = {xPosition + (width/2),xPosition, xPosition + width, xPosition, xPosition + width, xPosition + (width/2) };
- int[] ypoints = {yPosition, yPosition - (height/4), yPosition - (height/4), yPosition - (height/2),yPosition- (height/2), yPosition - height };
- canvas.draw(this, color, new Polygon(xpoints, ypoints, 6));
- canvas.wait(10);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement