Packages  This Package  Prev  Next  Index  

§1.34 Class Point

public  class  java.awt.Point
    extends  java.lang.Object  (I-§1.12)
{
        // Fields
    public int x;	§1.34.1
    public int y;	§1.34.2

        // Constructors
    public Point(int  x, int  y);	§1.34.3

        // Methods
    public boolean equals(Object  obj);	§1.34.4
    public int hashCode();	§1.34.5
    public void move(int  x, int  y);	§1.34.6
    public String toString();	§1.34.7
    public void translate(int  dx, int  dy);	§1.34.8
}
A point represents an coordinate.


Fields

x

public int x
The x coordinate.

y

public int y
The y coordinate.

Constructors

Point

public Point(int x, int y)
Constructs and initializes a point to the specified coordinate.
Parameters:
x - the x coordinate
y - the y coordinate

Methods

equals

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.
Parameters:
obj - the object to compare with.
Returns:
true if the objects are the same; false otherwise.
Overrides:
equals in class Object (I-§1.12.3).

hashCode

public int hashCode()
Returns:
a hash code value for this point.
Overrides:
hashCode in class Object (I-§1.12.6).

move

public void move(int x, int y)
Modifies this point so that it now represents the coordinates indicated.
Parameters:
x - the new x coordinate
y - the new y coordinate

toString

public String toString()
Returns:
a string representation of this point.
Overrides:
toString in class Object (I-§1.12.9).

translate

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 , where it had been representing the point .
Parameters:
dx - the amount to move this point to the right
dy - the amount to move this point downward

Packages  This Package  Prev  Next  Index
Java API Document (HTML generated by dkramer on April 22, 1996)
Copyright © 1996 Sun Microsystems, Inc. All rights reserved
Please send any comments or corrections to doug.kramer@sun.com