[kaffe] [PATCH] Make java.awt.Dimension extend java.awt.geom.Dimension2D

Benja Fallenstein b.fallenstein at gmx.de
Fri May 16 07:07:01 PDT 2003


Hi,

The attached patch makes java.awt.Dimension extend and implement 
java.awt.geom.Dimension2D, as in Sun's Java.

- Benja
-------------- next part --------------
Index: libraries/javalib/java/awt/Dimension.java
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/javalib/java/awt/Dimension.java,v
retrieving revision 1.6
diff -u -r1.6 Dimension.java
--- libraries/javalib/java/awt/Dimension.java	16 Mar 2002 18:36:59 -0000	1.6
+++ libraries/javalib/java/awt/Dimension.java	16 May 2003 14:03:47 -0000
@@ -1,4 +1,5 @@
 package java.awt;
+import java.awt.geom.Dimension2D;
 
 
 /**
@@ -12,7 +13,7 @@
  *
  * @author P.C.Mehlitz
  */
-public class Dimension implements java.io.Serializable
+public class Dimension extends Dimension2D implements java.io.Serializable
 {
 	private static final long serialVersionUID = 4723952579491349524L;
 	/** @serial The width dimension. Negative values can be used. */
@@ -43,6 +44,14 @@
 		return false;
 }
 
+public double getWidth() {
+	return width;
+}
+
+public double getHeight() {
+	return height;
+}
+
 public Dimension getSize () {
 	return new Dimension( width, height);
 }
@@ -52,9 +61,19 @@
 	height = d.height;
 }
 
+public void setSize ( Dimension2D d ) {
+	width  = (int)d.getWidth();
+	height = (int)d.getHeight();
+}
+
 public void setSize ( int w, int h ) {
 	width  = w;
 	height = h;
+}
+
+public void setSize ( double w, double h ) {
+	width  = (int)w;
+	height = (int)h;
 }
 
 public String toString() {


More information about the kaffe mailing list