Skip to main content

Theme Issue

1 reply [Last post]
Anonymous

Hi,

I presume that this code

Resources r = Resources.open("/javaTheme.res");
UIManager.getInstance().setThemeProps(r.getTheme("javaTheme"));

sets the theme application wide.

Apparently, if a ComboBox is the first component in a TabbedPane tab it
doesn't know the custom theme (see attachment). If a ComboBox is placed
into a container and the container is the fist component same thing. If
the ComboBox is the third, fourth ... component it know the custom
theme.

Hope I could make it clear.

Stephan

[att1.html]
[ComboBox1.png]
[ComboBox2.png]
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Shai Almog

Hi Stephan,
you are seeing a combination of several issues in this bug:

1. There seems to be a race condition between setting the theme in
your application and the combo box creation.

2. After setting the theme you need to go to every component root and
invoke refreshTheme, we do not do this implicitly since we don't keep
pointers to all components (that would kill memory) and components
don't constantly query UI (that would kill performance).
If you change a theme you must invoke refreshTheme() on a root, this
method is recursive so if you have one form you can treat it as a
root and that will work. If you have another form in memory we won't
be able to detect it unless you invoke refreshTheme() there too.

3. Renderer components in the current version don't refresh their
theme at all, this is an issue that is partially solved in the
upcoming release.

4. The new release still can't really update the theme in all the
renderers since this is really your job. A renderer might return a
different component for every model element and even for every call,
we have no way of knowing that when you invoke refreshTheme() on a
list. So it is the renderers responsibility to make sure the theme is
refreshed.
We try to solve the common problem: we invoke refreshTheme on the
first element in the list (or combo, same problem) or on null if the
list is empty! Then we invoke refresh theme on a renderer focus
component if it is not null.

Currently you can solve the issues you are seeing by:

myForm.refreshTheme();
myRenderer.refreshTheme();
Component c = myRenderer.getListFocusComponent();
if(c != null) {
c.refreshTheme();
}

Which should probably work assuming you used the default renderer.

Thanks,
Shai.

> Hi,
>
> I presume that this code
>
> Resources r = Resources.open("/javaTheme.res");
> UIManager.getInstance().setThemeProps(r.getTheme("javaTheme"));
>
> sets the theme application wide.
>
> Apparently, if a ComboBox is the first component in a TabbedPane
> tab it doesn't know the custom theme (see attachment). If a
> ComboBox is placed into a container and the container is the fist
> component same thing. If the ComboBox is the third, fourth ...
> component it know the custom theme.
>
> Hope I could make it clear.
>
> Stephan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net