1 /*
2 * Copyright (c) 1995, 2017, 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
34 import java.io.ObjectInputStream;
35 import java.io.ObjectOutputStream;
36 import java.util.EventListener;
37
38 import javax.accessibility.Accessible;
39 import javax.accessibility.AccessibleAction;
40 import javax.accessibility.AccessibleContext;
41 import javax.accessibility.AccessibleRole;
42 import javax.accessibility.AccessibleValue;
43
44 import sun.awt.AWTAccessor;
45
46 /**
47 * All items in a menu must belong to the class
48 * {@code MenuItem}, or one of its subclasses.
49 * <p>
50 * The default {@code MenuItem} object embodies
51 * a simple labeled menu item.
52 * <p>
53 * This picture of a menu bar shows five menu items:
54 * <IMG SRC="doc-files/MenuBar-1.gif" alt="The following text describes this graphic."
55 * style="float:center; margin: 7px 10px;">
56 * <br style="clear:left;">
57 * The first two items are simple menu items, labeled
58 * {@code "Basic"} and {@code "Simple"}.
59 * Following these two items is a separator, which is itself
60 * a menu item, created with the label {@code "-"}.
61 * Next is an instance of {@code CheckboxMenuItem}
62 * labeled {@code "Check"}. The final menu item is a
63 * submenu labeled <code>"More Examples"</code>,
64 * and this submenu is an instance of {@code Menu}.
65 * <p>
66 * When a menu item is selected, AWT sends an action event to
67 * the menu item. Since the event is an
68 * instance of {@code ActionEvent}, the {@code processEvent}
69 * method examines the event and passes it along to
70 * {@code processActionEvent}. The latter method redirects the
71 * event to any {@code ActionListener} objects that have
72 * registered an interest in action events generated by this
73 * menu item.
74 * <P>
75 * Note that the subclass {@code Menu} overrides this behavior and
|
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
34 import java.io.ObjectInputStream;
35 import java.io.ObjectOutputStream;
36 import java.util.EventListener;
37
38 import javax.accessibility.Accessible;
39 import javax.accessibility.AccessibleAction;
40 import javax.accessibility.AccessibleContext;
41 import javax.accessibility.AccessibleRole;
42 import javax.accessibility.AccessibleValue;
43
44 import sun.awt.AWTAccessor;
45
46 /**
47 * All items in a menu must belong to the class
48 * {@code MenuItem}, or one of its subclasses.
49 * <p>
50 * The default {@code MenuItem} object embodies
51 * a simple labeled menu item.
52 * <p>
53 * This picture of a menu bar shows five menu items:
54 * <IMG SRC="doc-files/MenuBar-1.gif" alt="The following text describes this
55 * graphic." style="margin: 7px 10px;">
56 * <br style="clear:left;">
57 * The first two items are simple menu items, labeled
58 * {@code "Basic"} and {@code "Simple"}.
59 * Following these two items is a separator, which is itself
60 * a menu item, created with the label {@code "-"}.
61 * Next is an instance of {@code CheckboxMenuItem}
62 * labeled {@code "Check"}. The final menu item is a
63 * submenu labeled <code>"More Examples"</code>,
64 * and this submenu is an instance of {@code Menu}.
65 * <p>
66 * When a menu item is selected, AWT sends an action event to
67 * the menu item. Since the event is an
68 * instance of {@code ActionEvent}, the {@code processEvent}
69 * method examines the event and passes it along to
70 * {@code processActionEvent}. The latter method redirects the
71 * event to any {@code ActionListener} objects that have
72 * registered an interest in action events generated by this
73 * menu item.
74 * <P>
75 * Note that the subclass {@code Menu} overrides this behavior and
|