Is there some technique to enable/disable the state of
visual components according to certain conditions?.

For example, imagine I have a button:

JButton a;

And the JButton must be enabled if conditions c1 and c2 are
true and condition c3 is false, and disabled otherwise.

The only thing I know to do is to call an own method
updateEnableDisableButtonA whenever some is changed that
affects to c1, c2 or c3, and to reevaluate the conditions in
this method and call the setEnabled(true) or setEnabled(false)
method in the JButton according to the evaluation result.

However, this is very error-prone (because you have to
remember calling the method whenever it's necessary) and
tedious.

I think perhaps there is some other efficient and clear
technique to do this. If you have some idea,
please tell me.

Thanks a lot.

_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing

Reply via email to