diff options
Diffstat (limited to 'libjava/java/awt/CheckboxGroup.java')
-rw-r--r-- | libjava/java/awt/CheckboxGroup.java | 58 |
1 files changed, 53 insertions, 5 deletions
diff --git a/libjava/java/awt/CheckboxGroup.java b/libjava/java/awt/CheckboxGroup.java index 0acd7b5..d098a42 100644 --- a/libjava/java/awt/CheckboxGroup.java +++ b/libjava/java/awt/CheckboxGroup.java @@ -8,11 +8,59 @@ details. */ package java.awt; -/* Status: Empty placeholder. */ +import java.io.Serializable; -public class CheckboxGroup +/** This class is used to groups checkbox components. + * @author Tom Tromey <tromey@redhat.com> + * @date December 25, 2000 + */ +public class CheckboxGroup implements Serializable { - // Fields from the serialization spec. Decalare others "transient". - boolean state; - int checkboxMenuItemSerializedDataVersion; + // Current set checkbox. + Checkbox selectedCheckbox; + + /** Create a new instance of CheckboxGroup. */ + public CheckboxGroup () + { + } + + /** Returns the currently selected checkbox in the group. + * @deprecated + */ + public Checkbox getCurrent () + { + return getSelectedCheckbox (); + } + + /** Returns the currently selected checkbox in the group. */ + public Checkbox getSelectedCheckbox () + { + return selectedCheckbox; + } + + /** Set the selected checkbox. + * @deprecated + */ + public synchronized void setCurrent (Checkbox checkbox) + { + setSelectedCheckbox (checkbox); + } + + /** Set the selected checkbox. */ + public synchronized void setSelectedCheckbox (Checkbox checkbox) + { + if (checkbox != null && checkbox.group != this) + return; + + selectedCheckbox.setState (false); + selectedCheckbox = checkbox; + if (checkbox != null) + checkbox.setState (true); + } + + /** Return String representation of this class and current Checkbox. */ + public String toString () + { + return "[CheckboxGroup: " + selectedCheckbox + "]"; + } } |