src/share/classes/java/awt/Polygon.java

Print this page




 334         }
 335         return bounds.getBounds();
 336     }
 337 
 338     /**
 339      * Determines whether the specified {@link Point} is inside this
 340      * <code>Polygon</code>.
 341      * @param p the specified <code>Point</code> to be tested
 342      * @return <code>true</code> if the <code>Polygon</code> contains the
 343      *                  <code>Point</code>; <code>false</code> otherwise.
 344      * @see #contains(double, double)
 345      * @since 1.0
 346      */
 347     public boolean contains(Point p) {
 348         return contains(p.x, p.y);
 349     }
 350 
 351     /**
 352      * Determines whether the specified coordinates are inside this
 353      * <code>Polygon</code>.
 354      * <p>
 355      * @param x the specified X coordinate to be tested
 356      * @param y the specified Y coordinate to be tested
 357      * @return {@code true} if this {@code Polygon} contains
 358      *         the specified coordinates {@code (x,y)};
 359      *         {@code false} otherwise.
 360      * @see #contains(double, double)
 361      * @since 1.1
 362      */
 363     public boolean contains(int x, int y) {
 364         return contains((double) x, (double) y);
 365     }
 366 
 367     /**
 368      * Determines whether the specified coordinates are contained in this
 369      * <code>Polygon</code>.
 370      * @param x the specified X coordinate to be tested
 371      * @param y the specified Y coordinate to be tested
 372      * @return {@code true} if this {@code Polygon} contains
 373      *         the specified coordinates {@code (x,y)};
 374      *         {@code false} otherwise.




 334         }
 335         return bounds.getBounds();
 336     }
 337 
 338     /**
 339      * Determines whether the specified {@link Point} is inside this
 340      * <code>Polygon</code>.
 341      * @param p the specified <code>Point</code> to be tested
 342      * @return <code>true</code> if the <code>Polygon</code> contains the
 343      *                  <code>Point</code>; <code>false</code> otherwise.
 344      * @see #contains(double, double)
 345      * @since 1.0
 346      */
 347     public boolean contains(Point p) {
 348         return contains(p.x, p.y);
 349     }
 350 
 351     /**
 352      * Determines whether the specified coordinates are inside this
 353      * <code>Polygon</code>.
 354      *
 355      * @param x the specified X coordinate to be tested
 356      * @param y the specified Y coordinate to be tested
 357      * @return {@code true} if this {@code Polygon} contains
 358      *         the specified coordinates {@code (x,y)};
 359      *         {@code false} otherwise.
 360      * @see #contains(double, double)
 361      * @since 1.1
 362      */
 363     public boolean contains(int x, int y) {
 364         return contains((double) x, (double) y);
 365     }
 366 
 367     /**
 368      * Determines whether the specified coordinates are contained in this
 369      * <code>Polygon</code>.
 370      * @param x the specified X coordinate to be tested
 371      * @param y the specified Y coordinate to be tested
 372      * @return {@code true} if this {@code Polygon} contains
 373      *         the specified coordinates {@code (x,y)};
 374      *         {@code false} otherwise.