Skip to main content

Components not automatically repainting

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
2 replies [Last post]
algatron
Offline
Joined: 2009-11-23

Hi,

I've been using LWUIT since 1.2, and currently using 1.4.
Early on in my project I would occasionaly run into some stubborn component that would not refresh/repaint itslelf properly, or layout the container properly.
So I had a few force container.layoutContainer(), component.repaint() kicking around.

Over the past 2 years or so I had increasingly more and more of these kind of issues, and no it seems that unless I manaualy force layouts and repaints after adding/removing anything, it just doesn't work.
I end up with custom lists, where I have form.getContentPane().repaint(); after adding or removing any component. Which is hugely expensive in some cases. (I work on low end devices)

So to compensate, I started painting to bitmaps and caching those.
Now even that is starting to get too expensive.

Is there something big that's changed since these early verisons, or am I missing somehting ?
Sorry I do not have a concrete example or demo midlet for this. Just wondering if anyone else has had these problems also ?

Thanks,
Brian

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
vprise
Offline
Joined: 2003-11-07

After adding a component you always need to revalidate the layout manually, LWUIT doesn't do that automatically. The reason is actually for performance especially on low end devices.

The alternative would be that LWUIT would call that logic for you and LWUIT can't know when you actually need that to be called. E.g. you want to add two buttons to LWUIT so you can revalidate after adding both, rather than LWUIT "seamlessly" revalidating after each one (which is why we are faster than LCDUI which does exactly that).

There were bugs in LWUIT where it tries to be "smart" about these things and repaints too much, these cause performance/battery drain issues and we fix allot of these constantly.

I can tell you we run on very low end devices without any special hacks for performance and we don't use any bitmap fonts.

Try LWUIT 1.5's LWUITDemo (after obfuscation) on said devices and also try some of our more elaborate demos (tzone etc.) or the simpler ones (Makeover, browser) and see if the performance is equivalent to what you would expect or to your application.

algatron
Offline
Joined: 2009-11-23

Ok thanks, I'll give 1.5 a shot.

Its not so much a performance thing as properly validating. I do prefer micro-manage the validation/painting for better performance.
I guess I was lucky enough to have it being done automatically properly in the past and now some of the things thats been removed over time has reverted back to manual.

Thanks for the response.