-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
1.1.8
-
generic
-
generic
Name: krT82822 Date: 04/22/99
1. Please run the following program on a machine which has Japenese Fonts installed and the Locale is ja_jp.
The stringWidth of 3Ws is different from that displayed in textField. The width of "W" displayed is approximately half of that returned by FontMetrics.
This happens only in Japan. Same code if run in other country(en_us) does not give this problem.
2. The source:
import java.awt.*;
public class WrongWidth extends Frame
{
TextField textField;
Font font;
FontMetrics fontMetrics;
int stringWidth;
public WrongWidth()
{
textField = new TextField("WWW");
font = new Font("Dialog",Font.PLAIN,12);
fontMetrics = Toolkit.getDefaultToolkit().getFontMetrics(font);
stringWidth = fontMetrics.stringWidth("WWW");
setLayout(null);
add(textField);
textField.setFont(font);
setFont(font);
textField.setBounds(20,30,stringWidth,30);
setBounds(100,100,200,200);
show();
}
public static void main(String[] args)
{
WrongWidth wrong = new WrongWidth();
}
public void paint(Graphics g)
{
g.drawLine(20,0,20,200);
g.drawLine(20+stringWidth,0,20+stringWidth,200);
g.drawString("WWW",20,80);
}
}
3. None
4. None
5. jdk1.1.8M
6.None
(Review ID: 57308)
======================================================================