Greg Brown wrote:
>> Which leads to another interesting discussion - is it possible to
>> recursively disable/enable a hierarchy of components, and how to do this
>> safely and easily.
>>     
>
> Disabling an ancestor implicitly disables the descendants - they won't show 
> their "disabled" states, but you won't be able to interact with them. You may 
> find the isBlocked() method useful - isEnabled() returns true if a component 
> is itself disabled, and isBlocked() returns true if the component or any of 
> its descedants are disabled.
>   
But that's the point - how do I make an entire hierarchy of components
show that they are disabled.
It's quite a common requirement, and it's fairly tricky to implement
well in Swing because some of the composite components don't like me
calling setEnabled() on their children, so doing a straightforward
traversal of the tree is problematic.
I have solved it in the general case using various hacks (including
reflection) but it's not pretty.

Regards, Noel Grandin

Reply via email to