Topic: paintComponent( Graphics g ) 中 g.drawString方法的怪问题

  Print this page

1.paintComponent( Graphics g ) 中 g.drawString方法的怪问题 Copy to clipboard
Posted by: sunmoon
Posted on: 2003-12-19 18:38

public void paintComponent( Graphics g ){
super.paintComponent( g );
g.translate(10, 0);
g.setFont(new Font("monospaced", Font.PLAIN, 12));
g.drawString("新規作成成新規作成成新規作成成新規作成成新規作成成新規作成成新規作成成新規作成成新規作成成新規作成成", 20, 20);
g.drawString("1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 20, 35);
}

当字体大小是双数时,预览长度同样
当字体大小是但数时,预览长度不同

想要每次预览长度都同样,各位有没有什么办法呢?

截图:

2.Re:paintComponent( Graphics g ) 中 g.drawString方法的怪问题 [Re: sunmoon] Copy to clipboard
Posted by: sunmoon
Posted on: 2003-12-19 18:39

当字体大小为单数时:
g.setFont(new Font("monospaced", Font.PLAIN, 13));

截图:


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923