-
Bug
-
Resolution: Fixed
-
P4
-
1.2.0, 1.2.1, 1.2.2, 1.3.0
-
beta
-
generic, x86, sparc
-
generic, solaris_2.5, windows_95, windows_nt
Name: mgC56079 Date: 06/09/99
Javadoc specs for public void setSize(double width, double height) in
java.awt.Dimension says:
"Set the size of this Dimension object to the specified width
and height in double precision."
However, in JDK 1.2.2-U this method does not set width and height
to specified values.
Here is the example demonstrating the bug:
------------- Test.java -------------------------
public class Test{
public static void main(String[] argv) {
java.awt.Dimension d = new java.awt.Dimension(10, 10);
d.setSize(3.4, 5.6);
System.out.println(d.toString());
}
}
----------- Output under JDK 1.2.2-U ------------
java.awt.Dimension[width=10,height=10]
But we are supposed to get something like java.awt.Dimension[width=4,height=6]
In Dimension.java we have the following
public void setSize(double width, double height) {
width = (int) Math.ceil(width);
height = (int) Math.ceil(height);
}
Obviously, we are missing reference to the class variables that can be
carried out by adding "this.".
======================================================================
Name: tb29552 Date: 02/11/2000
c:\jdk1.3\bin>java -version
java version "1.3.0rc1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0rc1-T)
Java HotSpot(TM) Client VM (build 1.3.0rc1-S, mixed mode)
The Dimension.setSize(double, double) doesn't work!
Source code:
public void setSize(double width, double height) {
width = (int) Math.ceil(width);
height = (int) Math.ceil(height);
}
should be:
public void setSize(double width, double height) {
this.width = (int) Math.ceil(width);
this.height = (int) Math.ceil(height);
}
The bug is in jdk 1.3 rc too!
regards
Roman
(Review ID: 101128)
======================================================================
- duplicates
-
JDK-4189446 java.awt.Dimension.setSize(double,double) does not work.
-
- Closed
-