开发者

Calculate String Width / Height on Blackberry

If I display 开发者_开发问答a string in a custom field using drawtext(txt,ax,ay) method, how can I calculate the string width / height.


Width:

int stringWidth = getFont().getAdvance(yourString);`

Height:

int stringHeight = getFont().getHeight();`

Those are if you're making the calls from within one of your Field's methods (meaning you have extended a Field). However, if you're simply trying to draw the string and are wondering what ax and ay represent, those are positions, not dimensions.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜