aspose file tools*
The moose likes Java Micro Edition and the fly likes How to set traverse string using canvas Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "How to set traverse string using canvas" Watch "How to set traverse string using canvas" New topic
Author

How to set traverse string using canvas

nagarjuan pula
Greenhorn

Joined: Sep 20, 2010
Posts: 9
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16014
    
  20

The text crawl effect is done by erasing the old text and writing it back into the canvas again only with a shifted "X" co-ordinate. You can do erasing in several different ways. One is by just resetting the rectangle that bounds the text to the canvas background color. Another is to rewrite the text in its original position, but using the canvas background color as the text color.

Then again, if the UI supports clipping (and I don't remember for the case of JME), you could simply set a clip rectangle to only repaint the area that holds the text and update the X co-ordinate in the paint method. Which is the preferred way to do things in systems that do painting in separate threads. For one thing, the clip/paint mechanism usually makes most effective use of the available graphics hardware and isn't impacted by other UI events.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
 
subject: How to set traverse string using canvas