1 /*
2 * Copyright (c) 1995, 2016, 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
35
36 import javax.accessibility.Accessible;
37 import javax.accessibility.AccessibleAction;
38 import javax.accessibility.AccessibleContext;
39 import javax.accessibility.AccessibleRole;
40 import javax.accessibility.AccessibleValue;
41
42 import sun.awt.AWTAccessor;
43
44 /**
45 * This class represents a check box that can be included in a menu.
46 * Selecting the check box in the menu changes its state from
47 * "on" to "off" or from "off" to "on."
48 * <p>
49 * The following picture depicts a menu which contains an instance
50 * of {@code CheckBoxMenuItem}:
51 * <p>
52 * <img src="doc-files/MenuBar-1.gif"
53 * alt="Menu labeled Examples, containing items Basic, Simple, Check, and More
54 * Examples. The Check item is a CheckBoxMenuItem instance, in the off state."
55 * style="float:center; margin: 7px 10px;">
56 * <p>
57 * The item labeled {@code Check} shows a check box menu item
58 * in its "off" state.
59 * <p>
60 * When a check box menu item is selected, AWT sends an item event to
61 * the item. Since the event is an instance of {@code ItemEvent},
62 * the {@code processEvent} method examines the event and passes
63 * it along to {@code processItemEvent}. The latter method redirects
64 * the event to any {@code ItemListener} objects that have
65 * registered an interest in item events generated by this menu item.
66 *
67 * @author Sami Shaio
68 * @see java.awt.event.ItemEvent
69 * @see java.awt.event.ItemListener
70 * @since 1.0
71 */
72 public class CheckboxMenuItem extends MenuItem implements ItemSelectable, Accessible {
73
74 static {
75 /* ensure that the necessary native libraries are loaded */
|
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
35
36 import javax.accessibility.Accessible;
37 import javax.accessibility.AccessibleAction;
38 import javax.accessibility.AccessibleContext;
39 import javax.accessibility.AccessibleRole;
40 import javax.accessibility.AccessibleValue;
41
42 import sun.awt.AWTAccessor;
43
44 /**
45 * This class represents a check box that can be included in a menu.
46 * Selecting the check box in the menu changes its state from
47 * "on" to "off" or from "off" to "on."
48 * <p>
49 * The following picture depicts a menu which contains an instance
50 * of {@code CheckBoxMenuItem}:
51 * <p>
52 * <img src="doc-files/MenuBar-1.gif"
53 * alt="Menu labeled Examples, containing items Basic, Simple, Check, and More
54 * Examples. The Check item is a CheckBoxMenuItem instance, in the off state."
55 * style="margin: 7px 10px;">
56 * <p>
57 * The item labeled {@code Check} shows a check box menu item
58 * in its "off" state.
59 * <p>
60 * When a check box menu item is selected, AWT sends an item event to
61 * the item. Since the event is an instance of {@code ItemEvent},
62 * the {@code processEvent} method examines the event and passes
63 * it along to {@code processItemEvent}. The latter method redirects
64 * the event to any {@code ItemListener} objects that have
65 * registered an interest in item events generated by this menu item.
66 *
67 * @author Sami Shaio
68 * @see java.awt.event.ItemEvent
69 * @see java.awt.event.ItemListener
70 * @since 1.0
71 */
72 public class CheckboxMenuItem extends MenuItem implements ItemSelectable, Accessible {
73
74 static {
75 /* ensure that the necessary native libraries are loaded */
|