Class Rectangle

  • All Implemented Interfaces:
    Shape, java.io.Serializable, java.lang.Cloneable

    public class Rectangle
    extends Rectangle2D
    implements Shape, java.io.Serializable
    See Also:
    Serialized Form
    • Field Detail

      • x

        public double x
      • y

        public double y
      • width

        public double width
      • height

        public double height
    • Constructor Detail

      • Rectangle

        public Rectangle()
      • Rectangle

        public Rectangle​(Point p)
      • Rectangle

        public Rectangle​(double x,
                         double y,
                         double width,
                         double height)
      • Rectangle

        public Rectangle​(int width,
                         int height)
      • Rectangle

        public Rectangle​(Rectangle r)
      • Rectangle

        public Rectangle​(Rectangle r)
      • Rectangle

        public Rectangle​(Dimension d)
    • Method Detail

      • setSize

        public void setSize​(int mx,
                            int my)
      • setSize

        public void setSize​(double width,
                            double height)
      • setSize

        public void setSize​(Dimension d)
      • getLocation

        public Point getLocation()
      • setLocation

        public void setLocation​(int mx,
                                int my)
      • setLocation

        public void setLocation​(double x,
                                double y)
      • setLocation

        public void setLocation​(Point p)
      • setRect

        public void setRect​(double x,
                            double y,
                            double width,
                            double height)
        Specified by:
        setRect in class Rectangle2D
      • setBounds

        public void setBounds​(int x,
                              int y,
                              int width,
                              int height)
      • setBounds

        public void setBounds​(double x,
                              double y,
                              double width,
                              double height)
      • setBounds

        public void setBounds​(Rectangle r)
      • grow

        public void grow​(int mx,
                         int my)
      • grow

        public void grow​(double dx,
                         double dy)
      • translate

        public void translate​(int mx,
                              int my)
      • translate

        public void translate​(double mx,
                              double my)
      • add

        public void add​(int px,
                        int py)
      • add

        public void add​(double px,
                        double py)
        Overrides:
        add in class Rectangle2D
      • add

        public void add​(Point p)
      • contains

        public boolean contains​(int px,
                                int py)
      • contains

        public boolean contains​(Point p)
      • contains

        public boolean contains​(int rx,
                                int ry,
                                int rw,
                                int rh)
      • contains

        public boolean contains​(double rx,
                                double ry,
                                double rw,
                                double rh)
        Specified by:
        contains in interface Shape
        Overrides:
        contains in class Rectangle2D
      • contains

        public boolean contains​(Rectangle r)
      • intersects

        public boolean intersects​(Rectangle r)
      • outcode

        public int outcode​(double px,
                           double py)
        Specified by:
        outcode in class Rectangle2D
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class Rectangle2D
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object