简体   繁体   中英

Showing formatted text on J2ME canvas

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM