Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,575 members, 7,820,068 topics. Date: Tuesday, 07 May 2024 at 09:16 AM

Help (wrap Text In J2ME & Scroll Vertically) - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Help (wrap Text In J2ME & Scroll Vertically) (1801 Views)

Please Help On How To Insert Smiley In An Output Text In Java Script / A Simple Solution To J2me Scroll Bar / Pagination Vs Infinite Scroll (2) (3) (4)

(1) (Reply)

Help (wrap Text In J2ME & Scroll Vertically) by EbiEsq(m): 2:28pm On Nov 26, 2012
I'm trying to draw string on a canvas. It is very long and it gets cut off because its not fitting into the screen. Please help me with any sample code that would draw a long string on a canvas and wrap it so that it won't get cut of and also implement vertical scrolling of the string. Thanks.
Re: Help (wrap Text In J2ME & Scroll Vertically) by Shimao(m): 3:33pm On Nov 26, 2012
You'll have to divide the long string into multiple lines based on how much the canvas width can take, then individually draw the lines on the canvas. Typically, you'll hold the lines in a vector. As for the scrolling part, you need to determine how many lines the canvas can display at a go, and use index shifting to determine what segment of the vector holding the lines should be drawn at any point. You could implement a line shifting or page shifting scrolling mechanism.

Check out this, it solves part 1, part 2 isn't that difficult.

http://www.developer.nokia.com/Community/Wiki/TextWrapUtil_to_draw_Multiple_line_text_in_Java_ME

(1) (Reply)

Software Programming / DHTML Trollin' On Godaddy - Guys You Must Not Miss This / Learn And Develop Real Life Web Applications In 11 Weeks

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 8
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.