1 /*
2 * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
29 * a set of {@code Checkbox} buttons.
30 * <p>
31 * Exactly one check box button in a {@code CheckboxGroup} can
32 * be in the "on" state at any given time. Pushing any
33 * button sets its state to "on" and forces any other button that
34 * is in the "on" state into the "off" state.
35 * <p>
36 * The following code example produces a new check box group,
37 * with three check boxes:
38 *
39 * <hr><blockquote><pre>
40 * setLayout(new GridLayout(3, 1));
41 * CheckboxGroup cbg = new CheckboxGroup();
42 * add(new Checkbox("one", cbg, true));
43 * add(new Checkbox("two", cbg, false));
44 * add(new Checkbox("three", cbg, false));
45 * </pre></blockquote><hr>
46 * <p>
47 * This image depicts the check box group created by this example:
48 * <p>
49 * <img src="doc-files/CheckboxGroup-1.gif"
50 * alt="Shows three checkboxes, arranged vertically, labeled one, two, and three. Checkbox one is in the on state."
51 * style="float:center; margin: 7px 10px;">
52 *
53 * @author Sami Shaio
54 * @see java.awt.Checkbox
55 * @since 1.0
56 */
57 public class CheckboxGroup implements java.io.Serializable {
58 /**
59 * The current choice.
60 * @serial
61 * @see #getCurrent()
62 * @see #setCurrent(Checkbox)
63 */
64 Checkbox selectedCheckbox = null;
65
66 /*
67 * JDK 1.1 serialVersionUID
68 */
69 private static final long serialVersionUID = 3729780091441768983L;
70
71 /**
|
1 /*
2 * Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
29 * a set of {@code Checkbox} buttons.
30 * <p>
31 * Exactly one check box button in a {@code CheckboxGroup} can
32 * be in the "on" state at any given time. Pushing any
33 * button sets its state to "on" and forces any other button that
34 * is in the "on" state into the "off" state.
35 * <p>
36 * The following code example produces a new check box group,
37 * with three check boxes:
38 *
39 * <hr><blockquote><pre>
40 * setLayout(new GridLayout(3, 1));
41 * CheckboxGroup cbg = new CheckboxGroup();
42 * add(new Checkbox("one", cbg, true));
43 * add(new Checkbox("two", cbg, false));
44 * add(new Checkbox("three", cbg, false));
45 * </pre></blockquote><hr>
46 * <p>
47 * This image depicts the check box group created by this example:
48 * <p>
49 * <img src="doc-files/CheckboxGroup-1.gif" alt="Shows three checkboxes,
50 * arranged vertically, labeled one, two, and three. Checkbox one is in the on
51 * state." style="margin: 7px 10px;">
52 *
53 * @author Sami Shaio
54 * @see java.awt.Checkbox
55 * @since 1.0
56 */
57 public class CheckboxGroup implements java.io.Serializable {
58 /**
59 * The current choice.
60 * @serial
61 * @see #getCurrent()
62 * @see #setCurrent(Checkbox)
63 */
64 Checkbox selectedCheckbox = null;
65
66 /*
67 * JDK 1.1 serialVersionUID
68 */
69 private static final long serialVersionUID = 3729780091441768983L;
70
71 /**
|