Class Polygon

All Implemented Interfaces:
IFigure
Direct Known Subclasses:
PolygonDecoration

public class Polygon extends Polyline
Renders a PointList as a polygonal shape. This class is similar to Polyline, except the PointList is closed and can be filled in as a solid shape.
See Also:
  • Constructor Details

    • Polygon

      public Polygon()
  • Method Details

    • containsPoint

      public boolean containsPoint(int x, int y)
      Returns whether the point (x,y) is contained inside this polygon.
      Specified by:
      containsPoint in interface IFigure
      Overrides:
      containsPoint in class Polyline
      Parameters:
      x - the X coordinate
      y - the Y coordinate
      Returns:
      whether the point (x,y) is contained in this polygon
      See Also:
    • shapeContainsPoint

      protected boolean shapeContainsPoint(int x, int y)
      Description copied from class: AbstractPointListShape
      Returns true if the point (x, y) is contained within this figure.
      Overrides:
      shapeContainsPoint in class Polyline
      Parameters:
      x - The X coordinate
      y - The Y coordinate
      Returns:
      true if the point (x,y) is contained in this figure
    • fillShape

      protected void fillShape(Graphics g)
      Fill the Polygon with the background color set by g.
      Overrides:
      fillShape in class Polyline
      Parameters:
      g - the Graphics object
      Since:
      2.0
      See Also:
    • outlineShape

      protected void outlineShape(Graphics g)
      Draw the outline of the Polygon.
      Overrides:
      outlineShape in class Polyline
      Parameters:
      g - the Graphics object
      Since:
      2.0
      See Also: