Search code examples
scrolllwuit

Scroling speeding in Components Lwuit


Most of the component in lwuit are scrolling slowly like TextArea or Container.

is it built-in in the component definition's? or can i control on speeding?

if so,how can i control them?


Solution

  • LWUIT spends most of its time in Font.stringWidth, wasting precious cpu cycles on basically the same strings again and again (with a new repaint after every scroll-step/focus change).

    The solution is to subclass Font, add a 'String Width Pool' that keeps track of, say, 30 strings at most and their widths. You then use this cache to return width of strings you're already aware of. This single change makes scrolling/flicking on the same devices much,much and much faster.

    Implement it and let me know if you get stuck somewhere.