Package breadboards

Class GOval

  • All Implemented Interfaces:
    Drawable

    public class GOval
    extends GObject
    Subclass of GObject used for displaying ovals
    Author:
    paul oser
    • Constructor Detail

      • GOval

        public GOval​(double width,
                     double height)
        constructs a GOval with specified width and height with upper left corner at (0,0)
        Parameters:
        width - the specified width
        height - the specified height
      • GOval

        public GOval​(double x,
                     double y,
                     double width,
                     double height)
        constructs a GOval with a specified width and height at a specified location
        Parameters:
        x - the x-coordinate of the upper left corner of the GOval
        y - the y-coordinate of the upper left corner of the GOval
        width - the specified width
        height - the specified height
    • Method Detail

      • getBounds

        public GRectangle getBounds()
        returns the bounding rectangle for this GOval
        Specified by:
        getBounds in class GObject
        Returns:
        the bounding rectangle for this GOval
      • getColor

        public java.awt.Color getColor()
        returns the border color of this GOval
        Returns:
        the border color of this GOval
      • getFillColor

        public java.awt.Color getFillColor()
        returns the fill color for this GOval
        Returns:
        the fill color for this GOval
      • getHeight

        public double getHeight()
        returns the height of this GOval
        Returns:
        the height of this GOval
      • getWidth

        public double getWidth()
        returns the width of this GOval
        Returns:
        the width of this GOval
      • isFilled

        public boolean isFilled()
        returns whether or not this GOval should be displayed with an opaque interior
        Returns:
        true if an opaque interior should be used, false otherwise
      • setColor

        public void setColor​(java.awt.Color color)
        sets the border color of the GOval to the specified color
        Parameters:
        color - the specified color
      • setFilled

        public void setFilled​(boolean isFilled)
        this must be called for the GOval to show an opaque interior
        Parameters:
        isFilled - true if an opaque interior is to be displayed, false otherwise
      • setFillColor

        public void setFillColor​(java.awt.Color fillColor)
        set the fill color for the opaque interior to the specified color
        Parameters:
        fillColor - the specified color
      • setSize

        public void setSize​(double width,
                            double height)
        set the width and height of the GOval to the specified values
        Parameters:
        width - the specified width
        height - the specified height
      • setBounds

        public void setBounds​(double x,
                              double y,
                              double width,
                              double height)
        set the width, height, and location of the GOval to the specified values
        Parameters:
        x - x-coordinate of the upper left corner of the GOval
        y - y-coordinate of the upper left corner of the GOval
        width - width the specified width
        height - height the specified height
      • setBounds

        public void setBounds​(GRectangle bounds)
        set the width, height, and location of the GOval to those associated with the specified bounding rectangle
        Parameters:
        bounds - a bounding rectangle for the GOval with the same dimensions and location
      • scale

        public void scale​(double sx,
                          double sy)
        scale the width of the GOval by a factor of sx and the height of the GOval by a factor of sy
        Parameters:
        sx - the horizontal scaling factor
        sy - the vertical scaling factor
      • scale

        public void scale​(double sf)
        scale this GOval by a factor of sf
        Parameters:
        sf - the scaling factor
      • draw

        public void draw​(java.awt.Graphics g)
        draws the GOval (generally not called directly)
      • contains

        public boolean contains​(double x,
                                double y)
        returns true if (x,y) is inside this GRect
        Specified by:
        contains in class GObject
        Parameters:
        x - the x-coordinate of the point in question
        y - the y-coordinate of the point in question
        Returns:
        true if (x,y) is inside this GRect, false otherwise