The NumberLabelGroup class provides a mechanism for exclusive selection among a set of NumberLabel objects. If a NumberLabel object belongs to a NumberLabelGroup, then the NumberLabel invokes the NumberLabelGroup select() and unselect() methods as appropriate. The curNL() method returns the currently selected NumberLabel, or null if none are selected.
package MyAwt;
import java.awt.*;
public class NumberLabelGroup extends Object {
private NumberLabel p_curNL=null;
public void select(NumberLabel numberLabel) {
if (p_curNL!=null && p_curNL!=numberLabel)
p_curNL.selected(false);
p_curNL=numberLabel;
}
public void unselect(NumberLabel numberLabel) {
if (p_curNL==numberLabel)
p_curNL=null;
}
public NumberLabel curNL() { return p_curNL; }
}