Re: Disabling generated buttons
Cecil Westerhof <Cecil@decebal.nl> writes:
That is for buttons that are stored in a variable, but these are not
stored in a variable but generated.
?Being stored in a variable? is not the opposite of ?being
generated?. Ultimatively, all objects are ?generated? at
some point in time after the start of the program. And
reference to all objects is stored in at least on variable,
because otherwise the garbage collector would dispose the
that object. So, all objects are always stored in a variable
and all objects are always generated.
Surely, a reference to the buttons is stored in at least one
variable, because Swing needs this information.
You need a means (direct or indirect) to obtain a reference
to these buttons (visibility). ?Indirect?, here, means: It
might suffice to know an object that holds the required information
and can perform the action which needs this information.
This is, ultimatively, related to the architecture of your software
(composition): Which object holds references to which other object?
If an object does not have a reference to another object, but
it needs to have this reference, then it is the duty of the
software architect to either make this object hold this reference
or otherwise rework the architecture, so that the object does
not need to hold the reference anymore. One related design
guideline is called ?Law Of Demeter?. Other guidelines are
architecure patterns such as the GRASP patterns.