]>
gcc.gnu.org Git - gcc.git/blob - libjava/java/awt/Point.java
1 /* Copyright (C) 1999 Red Hat, Inc.
3 This file is part of libjava.
5 This software is copyrighted work licensed under the terms of the
6 Libjava License. Please consult the file "LIBJAVA_LICENSE" for
10 import java
.awt
.geom
.Point2D
;
13 * @author Per Bothner <bothner@cygnus.com>
14 * @date February 8, 1999.
17 /* Written using "Java Class Libraries", 2nd edition, plus online
18 * API docs for JDK 1.2 beta from http://www.javasoft.com.
19 * Status: Believed complete and correct, except that neither toString
20 * nor hashCode have been compared with JDK output.
23 public class Point
extends Point2D
implements java
.io
.Serializable
30 public Point (Point p
) { this.x
= p
.x
; this.y
= p
.y
; }
32 public Point (int x
, int y
) { this.x
= x
; this.y
= y
; }
34 public boolean equals (Object obj
)
36 if (! (obj
instanceof Point
))
38 Point p
= (Point
) obj
;
39 return this.x
== p
.x
&& this.y
== p
.y
;
42 public int hashCode () { return x ^ y
; }
44 public Point
getLocation () { return new Point(this); }
46 public void move (int x
, int y
) { this.x
= x
; this.y
= y
; }
48 public void setLocation (int x
, int y
) { this.x
= x
; this.y
= y
; }
50 public void setLocation (Point pt
) { this.x
= pt
.x
; this.y
= pt
.y
; }
52 public void translate (int x
, int y
) { this.x
+= x
; this.y
+= y
; }
54 public String
toString ()
56 return "Point[x:"+x
+",y:"+y
+']';
59 public double getX() { return x
; }
60 public double getY() { return y
; }
62 public void setLocation (double x
, double y
)
63 { this.x
= (int) x
; this.y
= (int) y
; }
This page took 0.040086 seconds and 5 git commands to generate.