Point

Name

Point

[Graphic: Figure from the text]

Description

The Point class encapsulates a pair of x and y coordinates within a single object.

Class Definition

public class java.awt.Point extends java.lang.Object implements java.io.Serializable {
 // Variables public int x;
public int y; // Constructors public Point(); public Point (int width, int height);
public Point (Point p); // Instance Methods public boolean equals (Object object);
public Point getLocation(); public int hashCode();
public void move (int x, int y);
public void setLocation (int x, int y); public void setLocation (Point p); public String toString();
public void translate (int deltax, int deltay);
}

Variables

x

public int x

The coordinate that represents the horizontal position.

y

public int y

The coordinate that represents the vertical position.

Constructors

Point

public Point()

public Point (int x, int y)

public Point (Point p)

Instance Methods

equals

public boolean equals (Object object)

getLocation

public Point getLocation()

hashCode

public int hashCode()

move

public void move (int x, int y)

setLocation

public void setLocation (int x, int y)

public void setLocation (Point p)

toString

public String toString()

translate

public void translate (int deltax, int deltay)

See Also

Object, String