-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
1.4.0
-
x86
-
windows_nt
Name: jl125535 Date: 04/24/2002
FULL PRODUCT VERSION :
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)
A DESCRIPTION OF THE PROBLEM :
On JComponent, the setPreferredSize() setMaximumSize() and
setMinimumSize() methods directly store the passed-in
Dimension object. Subsequent changes to this object will
affect the JComponent! For example, I've seen code like
this more than once:
Dimension d = new Dimension(100, 20);
label.setPreferredSize(d);
d.width = 150;
label2.setPreferredSize(d);
This will cause both labels to have the same preferred
size. This is unlike most other Java calls (e.g. the
setSize() method).
This should be fixed or, if it's too late to fix it, should
at least be well-documented.
This bug can be reproduced always.
(Review ID: 145801)
======================================================================
- duplicates
-
JDK-4783989 get(Preferred|Minimum|Maximum)Size() return not an object copy
- Resolved