]>
gcc.gnu.org Git - gcc.git/blob - libjava/java/awt/Dimension.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
12 * @author Per Bothner <bothner@cygnus.com>
13 * @date Fenruary 8, 1999.
16 /* Written using "Java Class Libraries", 2nd edition, plus online
17 * API docs for JDK 1.2 beta from http://www.javasoft.com.
18 * Status: Believed complete and correct, except that neither toString
19 * has not been compared with JDK output.
22 public class Dimension
extends java
.awt
.geom
.Dimension2D
27 public Dimension () { }
29 public Dimension (Dimension dim
)
31 this.width
= dim
.width
;
32 this.height
= dim
.height
;
35 public Dimension (int width
, int height
)
41 public boolean equals (Object obj
)
43 if (! (obj
instanceof Dimension
))
45 Dimension dim
= (Dimension
) obj
;
46 return height
== dim
.height
&& width
== dim
.width
;
49 public Dimension
getSize () { return new Dimension(this); }
51 public void setSize (Dimension dim
)
53 this.width
= dim
.width
;
54 this.height
= dim
.height
;
57 public void setSize (int width
, int height
)
63 public String
toString ()
65 return "Dimension[w:"+width
+",h:"+height
+']';
68 /* Note: There is no Dimension.hashCode. */
70 public double getWidth() { return width
; }
71 public double getHeight() { return height
; }
73 public void setSize (double width
, double height
)
75 this.width
= (int) width
;
76 this.height
= (int) height
;
This page took 0.035237 seconds and 5 git commands to generate.