-
Bug
-
Resolution: Fixed
-
P3
-
1.3.0
-
beta
-
generic
-
generic
Name: krC82822 Date: 11/28/2000
orig synopsis: "getAlignment() in HiddenTagView does not provide correct values"
28 Nov 2000, eval1127@eng -- still present in current merlin sources.
-------------
java version "1.3.0" (and merlin)
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
package: javax.swing.text.html;
filename: HiddenTagView.java
have a look at the method "protected Component createComponent":
protected Component createComponent(){
...
updateYAlign(font);
...
}
and now have a look at the method "void updateYAlign(Font font)":
void updateYAlign(Font font) {
FontMetrics fm = Toolkit.getDefaultToolkit().getFontMetrics(font);
float h = fm.getHeight();
float d = fm.getDescent();
float yAlign = (h - d) / h;
}
all the vars are created locally in the method! So the method
has no effect. I think the declaration of "float yAlign" is
a mistake in this method because the InstanceVar "yAlign" is
not affected by this method. ( "yAlign" is initially set to "1",
so the getter method - getAlignment - will always return "1" ).
So the Solution will be:
void updateYAlign(Font font) {
FontMetrics fm = Toolkit.getDefaultToolkit().getFontMetrics(font);
float h = fm.getHeight();
float d = fm.getDescent();
yAlign = (h - d) / h;
}
(Review ID: 111465)
======================================================================