| Package java.awt |
Previous |
Java API |
Index |
Next |
public class java.awt.Point
extends java.lang.Object
{
// Fields
public int x;
public int y;
// Constructors
public Point(int x, int y);
// Methods
public boolean equals(Object obj);
public int hashCode();
public void move(int x, int y);
public String toString();
public void translate(int dx, int dy);
}
A point represents an (x,y) coordinate.
public int xThe x coordinate.
public int yThe y coordinate.
public Point(int x, int y)Constructs and initializes a point to the specified (x,y) coordinate.
Parameter Description x the x coordinate y the y coordinate
public boolean equals(Object obj)The result is true if and only if the argument is not null and is a Point object that has the same x and y coordinates as this object.
Return Value:
Returns true if the objects are the same; false otherwise.
Parameter Description obj the object to compare with. Overrides:
equals in class Object .
public int hashCode()Return Value:
Returns a hash code value for this point.
Overrides:
hashCode in class Object .
public void move(int x, int y)Modifies this point so that it now represents the (x,y) coordinates indicated.
Parameter Description x the new x coordinate y the new y coordinate
public String toString()Return Value:
Returns a string representation of this point.
Overrides:
toString in class Object .
public void translate(int dx, int dy)Translates this point by dx to the right and dy downward so that it now represents the point (x+dx, y+dy), where it had been representing the point (x,y).
Parameter Description dx the amount to move this point to the right dy the amount to move this point downward
| © 1996 Sun Microsystems, Inc. All rights reserved. |