KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > swing > event > MenuKeyEvent


1 /*
2  * @(#)MenuKeyEvent.java 1.13 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7 package javax.swing.event;
8
9 import javax.swing.MenuElement JavaDoc;
10 import javax.swing.MenuSelectionManager JavaDoc;
11 import java.util.EventObject JavaDoc;
12 import java.awt.event.KeyEvent JavaDoc;
13 import java.awt.Component JavaDoc;
14
15
16 /**
17  * MenuKeyEvent is used to notify interested parties that
18  * the menu element has received a KeyEvent forwarded to it
19  * in a menu tree.
20  * <p>
21  * <strong>Warning:</strong>
22  * Serialized objects of this class will not be compatible with
23  * future Swing releases. The current serialization support is
24  * appropriate for short term storage or RMI between applications running
25  * the same version of Swing. As of 1.4, support for long term storage
26  * of all JavaBeans<sup><font size="-2">TM</font></sup>
27  * has been added to the <code>java.beans</code> package.
28  * Please see {@link java.beans.XMLEncoder}.
29  *
30  * @version 1.13 12/19/03
31  * @author Georges Saab
32  */

33 public class MenuKeyEvent extends KeyEvent JavaDoc {
34     private MenuElement JavaDoc path[];
35     private MenuSelectionManager JavaDoc manager;
36
37     /**
38      * Constructs a MenuKeyEvent object.
39      *
40      * @param source the Component that originated the event
41      * (typically <code>this</code>)
42      * @param id an int specifying the type of event, as defined
43      * in {@link java.awt.event.KeyEvent}
44      * @param when a long identifying the time the event occurred
45      * @param modifiers an int specifying any modifier keys held down,
46      * as specified in {@link java.awt.event.InputEvent}
47      * @param keyCode an int specifying the specific key that was pressed
48      * @param keyChar a char specifying the key's character value, if any
49      * -- null if the key has no character value
50      * @param p an array of MenuElement objects specifying a path
51      * to a menu item affected by the drag
52      * @param m a MenuSelectionManager object that handles selections
53      */

54     public MenuKeyEvent(Component JavaDoc source, int id, long when, int modifiers,
55             int keyCode, char keyChar,
56             MenuElement JavaDoc p[], MenuSelectionManager JavaDoc m) {
57         super(source, id, when, modifiers, keyCode, keyChar);
58     path = p;
59     manager = m;
60     }
61
62     /**
63      * Returns the path to the menu item referenced by this event.
64      *
65      * @return an array of MenuElement objects representing the path value
66      */

67     public MenuElement JavaDoc[] getPath() {
68     return path;
69     }
70
71     /**
72      * Returns the current menu selection manager.
73      *
74      * @return a MenuSelectionManager object
75      */

76     public MenuSelectionManager JavaDoc getMenuSelectionManager() {
77     return manager;
78     }
79 }
80
81
Popular Tags