< prev index next >

src/java.desktop/share/classes/java/awt/Point.java

Print this page

        

*** 35,56 **** * @author Sami Shaio * @since 1.0 */ public class Point extends Point2D implements java.io.Serializable { /** ! * The X coordinate of this <code>Point</code>. * If no X coordinate is set it will default to 0. * * @serial * @see #getLocation() * @see #move(int, int) * @since 1.0 */ public int x; /** ! * The Y coordinate of this <code>Point</code>. * If no Y coordinate is set it will default to 0. * * @serial * @see #getLocation() * @see #move(int, int) --- 35,56 ---- * @author Sami Shaio * @since 1.0 */ public class Point extends Point2D implements java.io.Serializable { /** ! * The X coordinate of this {@code Point}. * If no X coordinate is set it will default to 0. * * @serial * @see #getLocation() * @see #move(int, int) * @since 1.0 */ public int x; /** ! * The Y coordinate of this {@code Point}. * If no Y coordinate is set it will default to 0. * * @serial * @see #getLocation() * @see #move(int, int)
*** 72,94 **** this(0, 0); } /** * Constructs and initializes a point with the same location as ! * the specified <code>Point</code> object. * @param p a point * @since 1.1 */ public Point(Point p) { this(p.x, p.y); } /** * Constructs and initializes a point at the specified * {@code (x,y)} location in the coordinate space. ! * @param x the X coordinate of the newly constructed <code>Point</code> ! * @param y the Y coordinate of the newly constructed <code>Point</code> * @since 1.0 */ public Point(int x, int y) { this.x = x; this.y = y; --- 72,94 ---- this(0, 0); } /** * Constructs and initializes a point with the same location as ! * the specified {@code Point} object. * @param p a point * @since 1.1 */ public Point(Point p) { this(p.x, p.y); } /** * Constructs and initializes a point at the specified * {@code (x,y)} location in the coordinate space. ! * @param x the X coordinate of the newly constructed {@code Point} ! * @param y the Y coordinate of the newly constructed {@code Point} * @since 1.0 */ public Point(int x, int y) { this.x = x; this.y = y;
*** 111,121 **** } /** * Returns the location of this point. * This method is included for completeness, to parallel the ! * <code>getLocation</code> method of <code>Component</code>. * @return a copy of this point, at the same location * @see java.awt.Component#getLocation * @see java.awt.Point#setLocation(java.awt.Point) * @see java.awt.Point#setLocation(int, int) * @since 1.1 --- 111,121 ---- } /** * Returns the location of this point. * This method is included for completeness, to parallel the ! * {@code getLocation} method of {@code Component}. * @return a copy of this point, at the same location * @see java.awt.Component#getLocation * @see java.awt.Point#setLocation(java.awt.Point) * @see java.awt.Point#setLocation(int, int) * @since 1.1
*** 126,136 **** } /** * Sets the location of the point to the specified location. * This method is included for completeness, to parallel the ! * <code>setLocation</code> method of <code>Component</code>. * @param p a point, the new location for this point * @see java.awt.Component#setLocation(java.awt.Point) * @see java.awt.Point#getLocation * @since 1.1 */ --- 126,136 ---- } /** * Sets the location of the point to the specified location. * This method is included for completeness, to parallel the ! * {@code setLocation} method of {@code Component}. * @param p a point, the new location for this point * @see java.awt.Component#setLocation(java.awt.Point) * @see java.awt.Point#getLocation * @since 1.1 */
*** 140,150 **** /** * Changes the point to have the specified location. * <p> * This method is included for completeness, to parallel the ! * <code>setLocation</code> method of <code>Component</code>. * Its behavior is identical with <code>move(int,&nbsp;int)</code>. * @param x the X coordinate of the new location * @param y the Y coordinate of the new location * @see java.awt.Component#setLocation(int, int) * @see java.awt.Point#getLocation --- 140,150 ---- /** * Changes the point to have the specified location. * <p> * This method is included for completeness, to parallel the ! * {@code setLocation} method of {@code Component}. * Its behavior is identical with <code>move(int,&nbsp;int)</code>. * @param x the X coordinate of the new location * @param y the Y coordinate of the new location * @see java.awt.Component#setLocation(int, int) * @see java.awt.Point#getLocation
*** 156,169 **** } /** * Sets the location of this point to the specified double coordinates. * The double values will be rounded to integer values. ! * Any number smaller than <code>Integer.MIN_VALUE</code> ! * will be reset to <code>MIN_VALUE</code>, and any number ! * larger than <code>Integer.MAX_VALUE</code> will be ! * reset to <code>MAX_VALUE</code>. * * @param x the X coordinate of the new location * @param y the Y coordinate of the new location * @see #getLocation */ --- 156,169 ---- } /** * Sets the location of this point to the specified double coordinates. * The double values will be rounded to integer values. ! * Any number smaller than {@code Integer.MIN_VALUE} ! * will be reset to {@code MIN_VALUE}, and any number ! * larger than {@code Integer.MAX_VALUE} will be ! * reset to {@code MAX_VALUE}. * * @param x the X coordinate of the new location * @param y the Y coordinate of the new location * @see #getLocation */
*** 201,217 **** this.y += dy; } /** * Determines whether or not two points are equal. Two instances of ! * <code>Point2D</code> are equal if the values of their ! * <code>x</code> and <code>y</code> member fields, representing * their position in the coordinate space, are the same. ! * @param obj an object to be compared with this <code>Point2D</code> ! * @return <code>true</code> if the object to be compared is ! * an instance of <code>Point2D</code> and has ! * the same values; <code>false</code> otherwise. */ public boolean equals(Object obj) { if (obj instanceof Point) { Point pt = (Point)obj; return (x == pt.x) && (y == pt.y); --- 201,217 ---- this.y += dy; } /** * Determines whether or not two points are equal. Two instances of ! * {@code Point2D} are equal if the values of their ! * {@code x} and {@code y} member fields, representing * their position in the coordinate space, are the same. ! * @param obj an object to be compared with this {@code Point2D} ! * @return {@code true} if the object to be compared is ! * an instance of {@code Point2D} and has ! * the same values; {@code false} otherwise. */ public boolean equals(Object obj) { if (obj instanceof Point) { Point pt = (Point)obj; return (x == pt.x) && (y == pt.y);
*** 222,232 **** /** * Returns a string representation of this point and its location * in the {@code (x,y)} coordinate space. This method is * intended to be used only for debugging purposes, and the content * and format of the returned string may vary between implementations. ! * The returned string may be empty but may not be <code>null</code>. * * @return a string representation of this point */ public String toString() { return getClass().getName() + "[x=" + x + ",y=" + y + "]"; --- 222,232 ---- /** * Returns a string representation of this point and its location * in the {@code (x,y)} coordinate space. This method is * intended to be used only for debugging purposes, and the content * and format of the returned string may vary between implementations. ! * The returned string may be empty but may not be {@code null}. * * @return a string representation of this point */ public String toString() { return getClass().getName() + "[x=" + x + ",y=" + y + "]";
< prev index next >