You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Edvin Syse <ed...@sysedata.no> on 2011/06/10 13:46:35 UTC

Override backgroundColor of ScrollPane

In some cases I want to change the backgroundColor of a ScrollPane. I do 
it like this:

         ScrollPaneSkin skin = (ScrollPaneSkin) getSkin();
         TerraTheme theme = (TerraTheme) Theme.getTheme();
         skin.setBackgroundColor(theme.getColor(10));

I don't care that I reference the TerraTheme directly, but apart from 
that - is this a good way to do it?

-- Edvin



Re: Override backgroundColor of ScrollPane

Posted by Edvin Syse <ed...@sysedata.no>.
Hehe.. that IS easier :) I got confused here for some reason... Better 
stop working for a while :)

Den 10.06.2011 13:53, skrev Chris Bartlett:
> scrollPane.getStyles().put("backgroundColor", 10); 

Re: Override backgroundColor of ScrollPane

Posted by Edvin Syse <ed...@sysedata.no>.
Den 10.06.2011 14:35, skrev Greg Brown:
>>> Are you doing this in a subclass of ScrollPane? If so, you could also define a custom subclass of ScrollPaneSkin that calls setBackgroundColor(10) in its constructor. We do something similar with some of the other Terra skins such as TerraBoxPaneSkin.
>>>
>> OK, good to know. Yes, it's a subclass, but it's created from bxml, so I just placed styles="{ backgroundColor: 10 }" in there for now :)
> You mean you are instantiating it in BXML? (you can't actually create a class in BXML)
Yeah, it's created from a bxml file via BXMLSerializer :)
> <MyScrollPane styles="{backgroundColor:10}"/>
>
> That's certainly valid, especially if you don't want all instances of MyScrollPane to use background color 10.
That's just my case :) Thanks for the help!

Re: Override backgroundColor of ScrollPane

Posted by Greg Brown <gk...@verizon.net>.
>> Are you doing this in a subclass of ScrollPane? If so, you could also define a custom subclass of ScrollPaneSkin that calls setBackgroundColor(10) in its constructor. We do something similar with some of the other Terra skins such as TerraBoxPaneSkin.
>> 
> OK, good to know. Yes, it's a subclass, but it's created from bxml, so I just placed styles="{ backgroundColor: 10 }" in there for now :)

You mean you are instantiating it in BXML? (you can't actually create a class in BXML)

<MyScrollPane styles="{backgroundColor:10}"/>

That's certainly valid, especially if you don't want all instances of MyScrollPane to use background color 10.

G


Re: Override backgroundColor of ScrollPane

Posted by Edvin Syse <ed...@sysedata.no>.

Den 10.06.2011 14:29, skrev Greg Brown:
> Are you doing this in a subclass of ScrollPane? If so, you could also 
> define a custom subclass of ScrollPaneSkin that calls 
> setBackgroundColor(10) in its constructor. We do something similar 
> with some of the other Terra skins such as TerraBoxPaneSkin.
>
OK, good to know. Yes, it's a subclass, but it's created from bxml, so I 
just placed styles="{ backgroundColor: 10 }" in there for now :)

Re: Override backgroundColor of ScrollPane

Posted by Greg Brown <gk...@verizon.net>.
Are you doing this in a subclass of ScrollPane? If so, you could also define a custom subclass of ScrollPaneSkin that calls setBackgroundColor(10) in its constructor. We do something similar with some of the other Terra skins such as TerraBoxPaneSkin.

On Jun 10, 2011, at 7:53 AM, Chris Bartlett wrote:

> scrollPane.getStyles().put("backgroundColor", 10); 
> 
> On 10 June 2011 18:46, Edvin Syse <ed...@sysedata.no> wrote:
> In some cases I want to change the backgroundColor of a ScrollPane. I do it like this:
> 
>        ScrollPaneSkin skin = (ScrollPaneSkin) getSkin();
>        TerraTheme theme = (TerraTheme) Theme.getTheme();
>        skin.setBackgroundColor(theme.getColor(10));
> 
> I don't care that I reference the TerraTheme directly, but apart from that - is this a good way to do it?
> 
> -- Edvin
> 
> 
> 


Re: Override backgroundColor of ScrollPane

Posted by Chris Bartlett <cb...@gmail.com>.
scrollPane.getStyles().put("backgroundColor", 10);

On 10 June 2011 18:46, Edvin Syse <ed...@sysedata.no> wrote:

> In some cases I want to change the backgroundColor of a ScrollPane. I do it
> like this:
>
>        ScrollPaneSkin skin = (ScrollPaneSkin) getSkin();
>        TerraTheme theme = (TerraTheme) Theme.getTheme();
>        skin.setBackgroundColor(theme.getColor(10));
>
> I don't care that I reference the TerraTheme directly, but apart from that
> - is this a good way to do it?
>
> -- Edvin
>
>
>