I want to show some text from my .ashx file on my J2ME canvas. But the '\n's used in original 开发者_运维技巧don't work here and all I get is a straight line. How do I add that formatting in here?
Thanks.
As far as I am aware there is no way to add formatting when displaying a String on a Canvas. You will have to manually add it yourself.
I guess you could parse the text into individual lines and then display each line in turn using graphics.drawString()
You can use font.getStringWidth() and font.getHeight() to check that your string will appear within the bounds of your canvas.
精彩评论