< prev index next >

src/java.desktop/share/classes/java/awt/Event.java

Print this page


   1 /*
   2  * Copyright (c) 1995, 2013, 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
  23  * questions.
  24  */
  25 package java.awt;
  26 
  27 import java.awt.event.*;
  28 import java.io.*;
  29 
  30 /**
  31  * <b>NOTE:</b> The {@code Event} class is obsolete and is
  32  * available only for backwards compatibility.  It has been replaced
  33  * by the {@code AWTEvent} class and its subclasses.
  34  * <p>
  35  * {@code Event} is a platform-independent class that
  36  * encapsulates events from the platform's Graphical User
  37  * Interface in the Java&nbsp;1.0 event model. In Java&nbsp;1.1
  38  * and later versions, the {@code Event} class is maintained
  39  * only for backwards compatibility. The information in this
  40  * class description is provided to assist programmers in
  41  * converting Java&nbsp;1.0 programs to the new event model.
  42  * <p>
  43  * In the Java&nbsp;1.0 event model, an event contains an
  44  * {@link Event#id} field
  45  * that indicates what type of event it is and which other
  46  * {@code Event} variables are relevant for the event.
  47  * <p>
  48  * For keyboard events, {@link Event#key}
  49  * contains a value indicating which key was activated, and
  50  * {@link Event#modifiers} contains the
  51  * modifiers for that event.  For the KEY_PRESS and KEY_RELEASE
  52  * event ids, the value of {@code key} is the unicode
  53  * character code for the key. For KEY_ACTION and
  54  * KEY_ACTION_RELEASE, the value of {@code key} is
  55  * one of the defined action-key identifiers in the
  56  * {@code Event} class ({@code PGUP},
  57  * {@code PGDN}, {@code F1}, {@code F2}, etc).
  58  *


  59  * @author     Sami Shaio
  60  * @since      1.0
  61  */

  62 public class Event implements java.io.Serializable {
  63     private transient long data;
  64 
  65     /* Modifier constants */
  66 
  67     /**
  68      * This flag indicates that the Shift key was down when the event
  69      * occurred.
  70      */
  71     public static final int SHIFT_MASK          = 1 << 0;
  72 
  73     /**
  74      * This flag indicates that the Control key was down when the event
  75      * occurred.
  76      */
  77     public static final int CTRL_MASK           = 1 << 1;
  78 
  79     /**
  80      * This flag indicates that the Meta key was down when the event
  81      * occurred. For mouse events, this flag indicates that the right


   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
  23  * questions.
  24  */
  25 package java.awt;
  26 
  27 import java.awt.event.KeyEvent;

  28 
  29 /**
  30  * <b>NOTE:</b> The {@code Event} class is obsolete and is
  31  * available only for backwards compatibility.  It has been replaced
  32  * by the {@code AWTEvent} class and its subclasses.
  33  * <p>
  34  * {@code Event} is a platform-independent class that
  35  * encapsulates events from the platform's Graphical User
  36  * Interface in the Java&nbsp;1.0 event model. In Java&nbsp;1.1
  37  * and later versions, the {@code Event} class is maintained
  38  * only for backwards compatibility. The information in this
  39  * class description is provided to assist programmers in
  40  * converting Java&nbsp;1.0 programs to the new event model.
  41  * <p>
  42  * In the Java&nbsp;1.0 event model, an event contains an
  43  * {@link Event#id} field
  44  * that indicates what type of event it is and which other
  45  * {@code Event} variables are relevant for the event.
  46  * <p>
  47  * For keyboard events, {@link Event#key}
  48  * contains a value indicating which key was activated, and
  49  * {@link Event#modifiers} contains the
  50  * modifiers for that event.  For the KEY_PRESS and KEY_RELEASE
  51  * event ids, the value of {@code key} is the unicode
  52  * character code for the key. For KEY_ACTION and
  53  * KEY_ACTION_RELEASE, the value of {@code key} is
  54  * one of the defined action-key identifiers in the
  55  * {@code Event} class ({@code PGUP},
  56  * {@code PGDN}, {@code F1}, {@code F2}, etc).
  57  *
  58  * @deprecated It is recommended that {@code AWTEvent} and its subclasses be
  59  *             used instead
  60  * @author     Sami Shaio
  61  * @since      1.0
  62  */
  63 @Deprecated(since = "9")
  64 public class Event implements java.io.Serializable {
  65     private transient long data;
  66 
  67     /* Modifier constants */
  68 
  69     /**
  70      * This flag indicates that the Shift key was down when the event
  71      * occurred.
  72      */
  73     public static final int SHIFT_MASK          = 1 << 0;
  74 
  75     /**
  76      * This flag indicates that the Control key was down when the event
  77      * occurred.
  78      */
  79     public static final int CTRL_MASK           = 1 << 1;
  80 
  81     /**
  82      * This flag indicates that the Meta key was down when the event
  83      * occurred. For mouse events, this flag indicates that the right


< prev index next >