Documentation of 'edu.rit.draw.item.ShapeItem' Java class
ShapeItem
edu.rit.draw.item

Class ShapeItem

  • All Implemented Interfaces:
    java.io.Externalizable, java.io.Serializable
    Direct Known Subclasses:
    Polygon, RectangularItem


    public abstract class ShapeItem
    extends FilledItem
    Class ShapeItem is the abstract base class for a DrawingItem that consists of a single 2-D graphics shape with an outline and an interior.
    See Also:
    Serialized Form
    • Constructor Detail

      • ShapeItem

        public ShapeItem()
        Construct a new shape item.
      • ShapeItem

        public ShapeItem(ShapeItem theItem)
        Construct a new shape item with the same outline and fill paint as the given shape item.
        Parameters:
        theItem - Shape item.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if theItem is null.
    • Method Detail

      • outline

        public ShapeItem outline(Outline theOutline)
        Set this shape item's outline.
        Overrides:
        outline in class FilledItem
        Parameters:
        theOutline - Outline, or Outline.NONE.
        Returns:
        This shape item.
      • fill

        public ShapeItem fill(Fill theFill)
        Set this shape item's fill paint.
        Overrides:
        fill in class FilledItem
        Parameters:
        theFill - Fill paint, or Fill.NONE.
        Returns:
        This shape item.
      • add

        public ShapeItem add()
        Add this shape item to the end of the default drawing's sequence of drawing items.
        Overrides:
        add in class FilledItem
        Returns:
        This shape item.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if there is no default drawing.
        See Also:
        Drawing.defaultDrawing()
      • add

        public ShapeItem add(Drawing theDrawing)
        Add this shape item to the end of the given drawing's sequence of drawing items.
        Overrides:
        add in class FilledItem
        Parameters:
        theDrawing - Drawing.
        Returns:
        This shape item.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if theDrawing is null.
      • addFirst

        public ShapeItem addFirst()
        Add this shape item to the beginning of the default drawing's sequence of drawing items.
        Overrides:
        addFirst in class FilledItem
        Returns:
        This shape item.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if there is no default drawing.
        See Also:
        Drawing.defaultDrawing()
      • addFirst

        public ShapeItem addFirst(Drawing theDrawing)
        Add this shape item to the beginning of the given drawing's sequence of drawing items.
        Overrides:
        addFirst in class FilledItem
        Parameters:
        theDrawing - Drawing.
        Returns:
        This shape item.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if theDrawing is null.
      • draw

        public void draw(java.awt.Graphics2D g2d)
        Draw this drawing item in the given graphics context. This method is allowed to change the graphics context's paint, stroke, and transform, and it doesn't have to change them back.
        Overrides:
        draw in class DrawingItem
        Parameters:
        g2d - 2-D graphics context.

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.