]> gcc.gnu.org Git - gcc.git/blob - libjava/java/awt/Dimension.java
natThrowable.cc: Don't use `#pragma implementation'.
[gcc.git] / libjava / java / awt / Dimension.java
1 /* Copyright (C) 1999 Red Hat, Inc.
2
3 This file is part of libjava.
4
5 This software is copyrighted work licensed under the terms of the
6 Libjava License. Please consult the file "LIBJAVA_LICENSE" for
7 details. */
8
9 package java.awt;
10
11 /**
12 * @author Per Bothner <bothner@cygnus.com>
13 * @date Fenruary 8, 1999.
14 */
15
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.
20 */
21
22 public class Dimension extends java.awt.geom.Dimension2D
23 {
24 public int height;
25 public int width;
26
27 public Dimension () { }
28
29 public Dimension (Dimension dim)
30 {
31 this.width = dim.width;
32 this.height = dim.height;
33 }
34
35 public Dimension (int width, int height)
36 {
37 this.width = width;
38 this.height = height;
39 }
40
41 public boolean equals (Object obj)
42 {
43 if (! (obj instanceof Dimension))
44 return false;
45 Dimension dim = (Dimension) obj;
46 return height == dim.height && width == dim.width;
47 }
48
49 public Dimension getSize () { return new Dimension(this); }
50
51 public void setSize (Dimension dim)
52 {
53 this.width = dim.width;
54 this.height = dim.height;
55 }
56
57 public void setSize (int width, int height)
58 {
59 this.width = width;
60 this.height = height;
61 }
62
63 public String toString ()
64 {
65 return "Dimension[w:"+width+",h:"+height+']';
66 }
67
68 /* Note: There is no Dimension.hashCode. */
69
70 public double getWidth() { return width; }
71 public double getHeight() { return height; }
72
73 public void setSize (double width, double height)
74 {
75 this.width = (int) width;
76 this.height = (int) height;
77 }
78 }
This page took 0.035237 seconds and 5 git commands to generate.