tags:

views:

155

answers:

2

Hi frnds, I'm going to develop j2me application I want to know, how i can wrap text on canvas according to screen width size in J2ME.

Thanks Neel

A: 

You need to calculate the width of the string to be drawn yourself and start a new line (split the string) each time you reach the max width of the canvas.

void paint(Graphics _g) {
  String t = "text to draw";
  int px_consumed = _g.getFont().substringWidth(t, 0, t.length())}
}
endevour
A: 

Check out ScrollableTextField in Forum Nokia http://wiki.forum.nokia.com/index.php/File:ScrollableTextField.zip

Azlam