Name: gm110360 Date: 03/08/2002
FULL PRODUCT VERSION :
java version "1.4.0-rc"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-rc-b91)
Java HotSpot(TM) Client VM (build 1.4.0-rc-b91, mixed mode)
FULL OPERATING SYSTEM VERSION : Windows 2000 Professional
5.00.2195
A DESCRIPTION OF THE PROBLEM :
g2.drawString(as.getIterator(), X, Y) displays very
unexpected results. The Attributes of the ArrbiutedString
are not displayed correctly. Even when the AttributedString
has no attributes (i.e. no as.addAttribute(AAA,,BBB,X,Y) is
called), the string is displyed strangely:
1-All characters are displayed in capital.
2-Some characters are not displyed.
3-Characters are displayed in bold.
4-Some characters on the same line are a bit above or below
others.
Note: I tested this in the paint method in a Frame (AWT)
component and in a JFrame (Swing). Also note that when
trying to display an AttributedString in the paintComponent
method in a JFrame nothing is displayed.
This bug does not occur with JDK 1.3.0. I have not tested
it with JDK 1.3.1
REGRESSION. Last worked in version 1.3
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
In the public void paint(Graphics g) for a Frame
1- define: Graphics2D g2 = (Graphics2D)g;
2- define: AttributedString as = new AttributedString(s);
3- (optional) add any attribute to the AttributedString by
as.addAttribute(AAA, BBB, X, Y);
4-g2.drawString(as.getIterator(), x-coor, y-coor);
EXPECTED VERSUS ACTUAL BEHAVIOR :
The display of the AttributedString is expected to be
normal with the attributes (if any) also displayed
correctly. Because of this bug, the results are far from
normal.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
No error messages.
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
//////////////////////////////////////////////
//NOTE IF THE LINE BEGININNG WITH as.addAttribute IS UNCOMMENTED, THE FOLLOWING
//SHOULD BE DISPLAYED:
// a big number 7^11 (7 to the power of 11)
//THE BUG IS OCCURS WITH AND WITHOUT COMMENTING THAT LINE
/////////////////////////////////////////////
import java.text.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.font.*;
import java.awt.geom.*;
public class IteratorTest2 {
static AffineTransform superTransform;
public static void main(String[] args) {
final Frame f = new Frame("IteratorTest v1.0") {
public void paint(Graphics g) {
Graphics2D g2 = (Graphics2D)g;
superTransform = AffineTransform.getScaleInstance(0.65, 0.65);
superTransform.translate(0, -7);
TransformAttribute superAttribute = new TransformAttribute
(superTransform);
String s = "a big number 7 11";
Dimension d = getSize();
AttributedString as = new AttributedString(s);
//as.addAttribute(TextAttribute.TRANSFORM, superAttribute,15,17);
//THE ABOVE LINE CAN BE UNCOMMENTED TO TEST THE ATTRIBUTE
g2.drawString(as.getIterator(), 40, 180);
}
};
f.setSize(500,400);
f.setVisible(true);
f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
f.dispose();
System.exit(0);
}
});
}
}
---------- END SOURCE ----------
CUSTOMER WORKAROUND :
I have not found any workaround.
Release Regression From : 1.3.1_02
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
(Review ID: 139280)
======================================================================