Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,207,521 members, 7,999,325 topics. Date: Monday, 11 November 2024 at 02:42 AM |
Nairaland Forum / Science/Technology / Programming / Help (wrap Text In J2ME & Scroll Vertically) (1850 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)
Programmer In Ilorin / Who Knows The Best Bulk SMS Site?? / Interesting C# And Dot Net Core Projects
(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. 5 |