Skip to main content

Use Style of an other component

3 replies [Last post]
danko
Offline
Joined: 2008-07-18
Points: 0

Hi,
what is the simplest way to use the style of one component by an other self written component without extend the class?
In my case I would like use the style of the TextField wtih my own component. If I use
getStyle().merge(UIManager.getInstance().getComponentStyle("TextField"));
in constructor the additional style attributes in the theme config file for my own component get lost.

Thanks for any help.
danko

Reply viewing options

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

Hi,
just implement the getUIID method and return "TextField" from this
method.

Thanks,
Shai.

> Hi,
> what is the simplest way to use the style of one component by an
> other self written component without extend the class?
> In my case I would like use the style of the TextField wtih my own
> component. If I use
> getStyle().merge(UIManager.getInstance().getComponentStyle
> ("TextField"));
> in constructor the additional style attributes in the theme config
> file for my own component get lost.
>
> Thanks for any help.
> danko
> [Message sent by forum member 'danko' (danko)]
>
> http://forums.java.net/jive/thread.jspa?messageID=288463
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>

Shai Almog
http://lwuit.blogspot.com/

[att1.html]

danko
Offline
Joined: 2008-07-18
Points: 0

If I return "TextField" I am not able to define attributes for my own component in theme config file.
My aim is to use the style of the TextField if nothing is defined for my own component. If an attribute for example MyComponent.bgColor=000000 is defined in the style config file I would like to use that one instead if the attribute TextField.bgColor .

I hope I could explain it clear enough.
Thanks,
danko

Shai Almog

Hi,
we only support one level of style propagation and don't encourage
something like this (as is possible with CSS). From our experience
these sort of styles cause a great deal of confusion for developers.
To cause style propagation just define the style globally or redefine
it for a specific component.

Thanks.

> If I return "TextField" I am not able to define attributes for my
> own component in theme config file.
> My aim is to use the style of the TextField if nothing is defined
> for my own component. If an attribute for example
> MyComponent.bgColor=000000 is defined in the style config file I
> would like to use that one instead if the attribute
> TextField.bgColor .
>
> I hope I could explain it clear enough.
> Thanks,
> danko
> [Message sent by forum member 'danko' (danko)]
>
> http://forums.java.net/jive/thread.jspa?messageID=288480
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>

Shai Almog
http://lwuit.blogspot.com/

[att1.html]