By adding a ComponentStateListener to the component's 
"getComponentStateListeners" list and then adding/removing the decorator inside 
the "enabledChanged" method of your listener.

Something like this:
        comp.getComponentStateListeners().add(new ComponentStateListener() {
                @Override
                public void enabledChanged(Component component) {
                        if (component.isEnabled())
                                remove decorator
                        else
                                attach decorator
                }
        });

Something like that (you'd have to put in a "focusedChanged" method also in 
this example), but hopefully you get the idea.

~Roger Whitcomb

On Oct 11, 2011, at 11:59 PM, Bill van Melle wrote:

> On Tue, Oct 11, 2011 at 8:43 PM, Greg Brown <[email protected]> wrote:
> 
>>> It took me a while to figure out I could simply
>>> override the skin's enabledChanged method to add or remove the decorator,
>>> but now I'm good.
>> 
>> Another option is to listen for changes to the enabled property of the
>> container, if that makes sense for your app.
>> 
> 
> Isn't that what I'm doing by overriding enabledChanged?  Not sure what
> you're getting at.

Reply via email to