1 /* Copyright (C) 2000 Free Software Foundation
3 This file is part of libgcj.
5 This software is copyrighted work licensed under the terms of the
6 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
11 import java
.io
.Serializable
;
13 /** This class is used to groups checkbox components.
14 * @author Tom Tromey <tromey@redhat.com>
15 * @date December 25, 2000
17 public class CheckboxGroup
implements Serializable
19 // Current set checkbox.
20 Checkbox selectedCheckbox
;
22 /** Create a new instance of CheckboxGroup. */
23 public CheckboxGroup ()
27 /** Returns the currently selected checkbox in the group.
30 public Checkbox
getCurrent ()
32 return getSelectedCheckbox ();
35 /** Returns the currently selected checkbox in the group. */
36 public Checkbox
getSelectedCheckbox ()
38 return selectedCheckbox
;
41 /** Set the selected checkbox.
44 public synchronized void setCurrent (Checkbox checkbox
)
46 setSelectedCheckbox (checkbox
);
49 /** Set the selected checkbox. */
50 public synchronized void setSelectedCheckbox (Checkbox checkbox
)
52 if (checkbox
!= null && checkbox
.group
!= this)
55 selectedCheckbox
.setState (false);
56 selectedCheckbox
= checkbox
;
58 checkbox
.setState (true);
61 /** Return String representation of this class and current Checkbox. */
62 public String
toString ()
64 return "[CheckboxGroup: " + selectedCheckbox
+ "]";