From: Jeff E. <jem...@fr...> - 2005-05-21 17:24:02
|
The group provides for mutual exclusion. When one button in the group is selected, then all others in the group are deselected. The group is not a component that contains the buttons. In this case, the panel is the containing component. ytc...@ya... wrote: > I am working through the python with java class libraries book and stumbled upon something which does not seem intuitive to me. > > On page 307 there is an example of adding radio buttons to a group. The code is as follows: > ... > for a_radiobutton in radiobuttons: > group.add(a_radiobutton) #so far so good > panel.add(a_radiobutton) # this is the line that confuses me > ... > > I would have though that the buttons would all be added to the group and then (after the "for" loop completes) the group would be added to the panel. However, that doesn't work. > > Why is it that the group can't simply be added to the panel? > > > > > |