2
|
1 |
/*
|
5506
|
2 |
* Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
|
2
|
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
|
5506
|
7 |
* published by the Free Software Foundation. Oracle designates this
|
2
|
8 |
* particular file as subject to the "Classpath" exception as provided
|
5506
|
9 |
* by Oracle in the LICENSE file that accompanied this code.
|
2
|
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 |
*
|
5506
|
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
|
|
23 |
* questions.
|
2
|
24 |
*/
|
|
25 |
package javax.swing.event;
|
|
26 |
|
|
27 |
import javax.swing.MenuElement;
|
|
28 |
import javax.swing.MenuSelectionManager;
|
|
29 |
import java.util.EventObject;
|
|
30 |
import java.awt.event.KeyEvent;
|
|
31 |
import java.awt.Component;
|
|
32 |
|
|
33 |
|
|
34 |
/**
|
|
35 |
* MenuKeyEvent is used to notify interested parties that
|
|
36 |
* the menu element has received a KeyEvent forwarded to it
|
|
37 |
* in a menu tree.
|
|
38 |
* <p>
|
|
39 |
* <strong>Warning:</strong>
|
|
40 |
* Serialized objects of this class will not be compatible with
|
|
41 |
* future Swing releases. The current serialization support is
|
|
42 |
* appropriate for short term storage or RMI between applications running
|
|
43 |
* the same version of Swing. As of 1.4, support for long term storage
|
20458
|
44 |
* of all JavaBeans™
|
2
|
45 |
* has been added to the <code>java.beans</code> package.
|
|
46 |
* Please see {@link java.beans.XMLEncoder}.
|
|
47 |
*
|
|
48 |
* @author Georges Saab
|
|
49 |
*/
|
11268
|
50 |
@SuppressWarnings("serial")
|
2
|
51 |
public class MenuKeyEvent extends KeyEvent {
|
|
52 |
private MenuElement path[];
|
|
53 |
private MenuSelectionManager manager;
|
|
54 |
|
|
55 |
/**
|
|
56 |
* Constructs a MenuKeyEvent object.
|
|
57 |
*
|
|
58 |
* @param source the Component that originated the event
|
|
59 |
* (typically <code>this</code>)
|
|
60 |
* @param id an int specifying the type of event, as defined
|
|
61 |
* in {@link java.awt.event.KeyEvent}
|
|
62 |
* @param when a long identifying the time the event occurred
|
|
63 |
* @param modifiers an int specifying any modifier keys held down,
|
|
64 |
* as specified in {@link java.awt.event.InputEvent}
|
|
65 |
* @param keyCode an int specifying the specific key that was pressed
|
|
66 |
* @param keyChar a char specifying the key's character value, if any
|
|
67 |
* -- null if the key has no character value
|
|
68 |
* @param p an array of MenuElement objects specifying a path
|
|
69 |
* to a menu item affected by the drag
|
|
70 |
* @param m a MenuSelectionManager object that handles selections
|
|
71 |
*/
|
|
72 |
public MenuKeyEvent(Component source, int id, long when, int modifiers,
|
|
73 |
int keyCode, char keyChar,
|
|
74 |
MenuElement p[], MenuSelectionManager m) {
|
|
75 |
super(source, id, when, modifiers, keyCode, keyChar);
|
|
76 |
path = p;
|
|
77 |
manager = m;
|
|
78 |
}
|
|
79 |
|
|
80 |
/**
|
|
81 |
* Returns the path to the menu item referenced by this event.
|
|
82 |
*
|
|
83 |
* @return an array of MenuElement objects representing the path value
|
|
84 |
*/
|
|
85 |
public MenuElement[] getPath() {
|
|
86 |
return path;
|
|
87 |
}
|
|
88 |
|
|
89 |
/**
|
|
90 |
* Returns the current menu selection manager.
|
|
91 |
*
|
|
92 |
* @return a MenuSelectionManager object
|
|
93 |
*/
|
|
94 |
public MenuSelectionManager getMenuSelectionManager() {
|
|
95 |
return manager;
|
|
96 |
}
|
|
97 |
}
|