-
Bug
-
Resolution: Fixed
-
P4
-
1.2.0
-
beta
-
generic
-
generic
Name: dbT83986 Date: 12/27/98
The description of the method Insets getInsets(Insets)
in JComponent says that the buffer returned does not have
to be the buffer given to the method as argument.
But in the BasicLabelUI.paint(Graphics, JComponent) method,
you assign the resulting buffer to a static member, to which
others have access.
This leads to the following problems:
Every doLayout uses other insets, because the values in it get
manipulated from different sources. The GUI-Compoents like
JButton, JLabel returned high preferred sizes and the text in
them got painted on very strange positions.
Therefore you shouldn't assign the returned value to a static member.
You don't have to change the strategy to avoid allocations of
the Insets Object, but you have to use a temporary local
reference in the paint method. I don't know if this problem resides
even in other implementations, I hope not!
Thanks
P@trick
(Review ID: 41830)
======================================================================