- java.lang.Object
-
- java.awt.Event
-
- 实现的所有接口
-
Serializable
@Deprecated(since="9") public class Event extends Object implements Serializable
Deprecated.It is recommended thatAWTEventand its subclasses be used instead注意:Event类已过时,仅可用于向后兼容。 它已被AWTEvent类及其子类所取代。Event是一个独立于平台的类,它封装来自Java 1.0事件模型中平台的图形用户界面的事件。 在Java 1.1及更高版本中,仅为了向后兼容性而维护Event类。 提供此类描述中的信息是为了帮助程序员将Java 1.0程序转换为新的事件模型。在Java 1.0事件模型中,事件包含
id字段,该字段指示它是什么类型的事件以及哪些其他Event变量与事件相关。对于键盘事件,
key包含一个值,指示激活了哪个键,modifiers包含该事件的修饰符。 对于KEY_PRESS和KEY_RELEASE事件ID,值key是键的unicode字符代码。 对于KEY_ACTION和KEY_ACTION_RELEASE,的值key是在所定义的动作密钥标识符之一Event类(PGUP,PGDN,F1,F2,等)。- 从以下版本开始:
- 1.0
- 另请参见:
- Serialized Form
-
-
字段汇总
字段 变量和类型 字段 描述 static intACTION_EVENT已过时。此事件表示用户希望执行某些操作。static intALT_MASK已过时。此标志表示事件发生时Alt键已关闭。Objectarg已过时。事件的任意参数。static intBACK_SPACE已过时。BackSpace键。static intCAPS_LOCK已过时。Caps Lock键,非ASCII动作键。intclickCount已过时。对于MOUSE_DOWN事件,此字段指示连续点击次数。static intCTRL_MASK已过时。此标志表示事件发生时Control键已关闭。static intDELETE已过时。删除键。static intDOWN已过时。向下箭头键,非ASCII动作键。static intEND已过时。结束键,非ASCII动作键。static intENTER已过时。Enter键。static intESCAPE已过时。逃生键。Eventevt已过时。下一个活动。static intF1已过时。F1功能键,非ASCII动作键。static intF10已过时。F10功能键,非ASCII动作键。static intF11已过时。F11功能键,非ASCII动作键。static intF12已过时。F12功能键,非ASCII动作键。static intF2已过时。F2功能键,非ASCII动作键。static intF3已过时。F3功能键,非ASCII动作键。static intF4已过时。F4功能键,非ASCII动作键。static intF5已过时。F5功能键,非ASCII动作键。static intF6已过时。F6功能键,非ASCII动作键。static intF7已过时。F7功能键,非ASCII动作键。static intF8已过时。F8功能键,非ASCII动作键。static intF9已过时。F9功能键,非ASCII动作键。static intGOT_FOCUS已过时。一个组件获得了关注。static intHOME已过时。Home键,非ASCII动作键。intid已过时。指示事件的事件类型以及与事件相关的其他Event变量。static intINSERT已过时。Insert键,非ASCII动作键。intkey已过时。在键盘事件中按下的键的键代码。static intKEY_ACTION已过时。用户按下了非ASCII 动作键。static intKEY_ACTION_RELEASE已过时。用户已发布非ASCII 动作键。static intKEY_PRESS已过时。用户按下了普通键。static intKEY_RELEASE已过时。用户已释放正常密钥。static intLEFT已过时。左箭头键,非ASCII动作键。static intLIST_DESELECT已过时。已取消选择列表中的项目。static intLIST_SELECT已过时。已选择列表中的项目。static intLOAD_FILE已过时。文件加载事件。static intLOST_FOCUS已过时。一个组件失去了焦点。static intMETA_MASK已过时。此标志表示事件发生时Meta键已关闭。intmodifiers已过时。修饰键的状态。static intMOUSE_DOWN已过时。用户按下了鼠标按钮。static intMOUSE_DRAG已过时。用户已按下按钮移动鼠标。static intMOUSE_ENTER已过时。鼠标已进入组件。static intMOUSE_EXIT已过时。鼠标已退出组件。static intMOUSE_MOVE已过时。鼠标移动时没有按下任何按钮。static intMOUSE_UP已过时。用户已释放鼠标按钮。static intNUM_LOCK已过时。Num Lock键,非ASCII动作键。static intPAUSE已过时。Pause键,非ASCII动作键。static intPGDN已过时。Page Down键,非ASCII动作键。static intPGUP已过时。Page Up键,非ASCII动作键。static intPRINT_SCREEN已过时。Print Screen键,非ASCII动作键。static intRIGHT已过时。右箭头键,非ASCII动作键。static intSAVE_FILE已过时。文件保存事件。static intSCROLL_ABSOLUTE已过时。用户已将气泡(拇指)移动到滚动条中,移动到“绝对”位置,而不是从最后位置偏移。static intSCROLL_BEGIN已过时。滚动开始事件。static intSCROLL_END已过时。滚动结束事件。static intSCROLL_LINE_DOWN已过时。用户已激活滚动条的 线下区域。static intSCROLL_LINE_UP已过时。用户已经激活的滚动条的 排队区域。static intSCROLL_LOCK已过时。Scroll Lock键,非ASCII动作键。static intSCROLL_PAGE_DOWN已过时。用户激活滚动条的 向下翻页区域。static intSCROLL_PAGE_UP已过时。用户已经激活了滚动条 上的 page up区域。static intSHIFT_MASK已过时。此标志表示事件发生时Shift键已关闭。static intTAB已过时。Tab键。Objecttarget已过时。目标组件。static intUP已过时。向上箭头键,非ASCII动作键。longwhen已过时。时间戳。static intWINDOW_DEICONIFY已过时。用户已要求窗口管理器对窗口进行去图标化。static intWINDOW_DESTROY已过时。用户已要求窗口管理器终止窗口。static intWINDOW_EXPOSE已过时。用户已要求窗口管理器公开窗口。static intWINDOW_ICONIFY已过时。用户已要求窗口管理器将窗口图标化。static intWINDOW_MOVED已过时。用户已要求窗口管理器移动窗口。intx已过时。事件的 x坐标。inty已过时。事件的 y坐标。
-
构造方法摘要
构造方法 构造器 描述 Event(Object target, int id, Object arg)已过时。注意:Event类已过时,仅可用于向后兼容。Event(Object target, long when, int id, int x, int y, int key, int modifiers)已过时。注意:Event类已过时,仅可用于向后兼容。Event(Object target, long when, int id, int x, int y, int key, int modifiers, Object arg)已过时。注意:Event类已过时,仅可用于向后兼容。
-
方法摘要
所有方法 实例方法 具体的方法 弃用的方法 变量和类型 方法 描述 booleancontrolDown()已过时。注意:Event类已过时,仅可用于向后兼容。booleanmetaDown()已过时。注意:Event类已过时,仅可用于向后兼容。protected StringparamString()已过时。注意:Event类已过时,仅可用于向后兼容。booleanshiftDown()已过时。注意:Event类已过时,仅可用于向后兼容。StringtoString()已过时。注意:Event类已过时,仅可用于向后兼容。voidtranslate(int dx, int dy)已过时。注意:Event类已过时,仅可用于向后兼容。
-
-
-
字段详细信息
-
SHIFT_MASK
public static final int SHIFT_MASK
Deprecated.此标志表示事件发生时Shift键已关闭。- 另请参见:
- 常数字段值
-
CTRL_MASK
public static final int CTRL_MASK
Deprecated.此标志表示事件发生时Control键已关闭。- 另请参见:
- 常数字段值
-
META_MASK
public static final int META_MASK
Deprecated.此标志表示事件发生时Meta键已关闭。 对于鼠标事件,此标志表示按下或释放了右键。- 另请参见:
- 常数字段值
-
ALT_MASK
public static final int ALT_MASK
Deprecated.此标志表示事件发生时Alt键已关闭。 对于鼠标事件,此标志表示已按下或释放鼠标中键。- 另请参见:
- 常数字段值
-
HOME
public static final int HOME
Deprecated.Home键,非ASCII动作键。- 另请参见:
- 常数字段值
-
END
public static final int END
Deprecated.结束键,非ASCII动作键。- 另请参见:
- 常数字段值
-
PGUP
public static final int PGUP
Deprecated.Page Up键,非ASCII动作键。- 另请参见:
- 常数字段值
-
PGDN
public static final int PGDN
Deprecated.Page Down键,非ASCII动作键。- 另请参见:
- 常数字段值
-
UP
public static final int UP
Deprecated.向上箭头键,非ASCII动作键。- 另请参见:
- 常数字段值
-
DOWN
public static final int DOWN
Deprecated.向下箭头键,非ASCII动作键。- 另请参见:
- 常数字段值
-
LEFT
public static final int LEFT
Deprecated.左箭头键,非ASCII动作键。- 另请参见:
- 常数字段值
-
RIGHT
public static final int RIGHT
Deprecated.右箭头键,非ASCII动作键。- 另请参见:
- 常数字段值
-
F1
public static final int F1
Deprecated.F1功能键,非ASCII动作键。- 另请参见:
- 常数字段值
-
F2
public static final int F2
Deprecated.F2功能键,非ASCII动作键。- 另请参见:
- 常数字段值
-
F3
public static final int F3
Deprecated.F3功能键,非ASCII动作键。- 另请参见:
- 常数字段值
-
F4
public static final int F4
Deprecated.F4功能键,非ASCII动作键。- 另请参见:
- 常数字段值
-
F5
public static final int F5
Deprecated.F5功能键,非ASCII动作键。- 另请参见:
- 常数字段值
-
F6
public static final int F6
Deprecated.F6功能键,非ASCII动作键。- 另请参见:
- 常数字段值
-
F7
public static final int F7
Deprecated.F7功能键,非ASCII动作键。- 另请参见:
- 常数字段值
-
F8
public static final int F8
Deprecated.F8功能键,非ASCII动作键。- 另请参见:
- 常数字段值
-
F9
public static final int F9
Deprecated.F9功能键,非ASCII动作键。- 另请参见:
- 常数字段值
-
F10
public static final int F10
Deprecated.F10功能键,非ASCII动作键。- 另请参见:
- 常数字段值
-
F11
public static final int F11
Deprecated.F11功能键,非ASCII动作键。- 另请参见:
- 常数字段值
-
F12
public static final int F12
Deprecated.F12功能键,非ASCII动作键。- 另请参见:
- 常数字段值
-
PRINT_SCREEN
public static final int PRINT_SCREEN
Deprecated.Print Screen键,非ASCII动作键。- 另请参见:
- 常数字段值
-
SCROLL_LOCK
public static final int SCROLL_LOCK
Deprecated.Scroll Lock键,非ASCII动作键。- 另请参见:
- 常数字段值
-
CAPS_LOCK
public static final int CAPS_LOCK
Deprecated.Caps Lock键,非ASCII动作键。- 另请参见:
- 常数字段值
-
NUM_LOCK
public static final int NUM_LOCK
Deprecated.Num Lock键,非ASCII动作键。- 另请参见:
- 常数字段值
-
PAUSE
public static final int PAUSE
Deprecated.Pause键,非ASCII动作键。- 另请参见:
- 常数字段值
-
INSERT
public static final int INSERT
Deprecated.Insert键,非ASCII动作键。- 另请参见:
- 常数字段值
-
ENTER
public static final int ENTER
Deprecated.Enter键。- 另请参见:
- 常数字段值
-
BACK_SPACE
public static final int BACK_SPACE
Deprecated.BackSpace键。- 另请参见:
- 常数字段值
-
TAB
public static final int TAB
Deprecated.Tab键。- 另请参见:
- 常数字段值
-
ESCAPE
public static final int ESCAPE
Deprecated.逃生键。- 另请参见:
- 常数字段值
-
DELETE
public static final int DELETE
Deprecated.删除键。- 另请参见:
- 常数字段值
-
WINDOW_DESTROY
public static final int WINDOW_DESTROY
Deprecated.用户已要求窗口管理器终止窗口。- 另请参见:
- 常数字段值
-
WINDOW_EXPOSE
public static final int WINDOW_EXPOSE
Deprecated.用户已要求窗口管理器公开窗口。- 另请参见:
- 常数字段值
-
WINDOW_ICONIFY
public static final int WINDOW_ICONIFY
Deprecated.用户已要求窗口管理器将窗口图标化。- 另请参见:
- 常数字段值
-
WINDOW_DEICONIFY
public static final int WINDOW_DEICONIFY
Deprecated.用户已要求窗口管理器对窗口进行去图标化。- 另请参见:
- 常数字段值
-
WINDOW_MOVED
public static final int WINDOW_MOVED
Deprecated.用户已要求窗口管理器移动窗口。- 另请参见:
- 常数字段值
-
KEY_PRESS
public static final int KEY_PRESS
Deprecated.用户按下了普通键。- 另请参见:
- 常数字段值
-
KEY_RELEASE
public static final int KEY_RELEASE
Deprecated.用户已释放正常密钥。- 另请参见:
- 常数字段值
-
KEY_ACTION
public static final int KEY_ACTION
Deprecated.用户按下了非ASCII 动作键。key字段包含一个值,指示事件发生在其中一个操作键上,其中包括12个功能键,箭头(光标)键,Page Up,Page Down,Home,End,Print Screen,Scroll Lock,Caps锁定,Num Lock,暂停和插入。- 另请参见:
- 常数字段值
-
KEY_ACTION_RELEASE
public static final int KEY_ACTION_RELEASE
Deprecated.用户已发布非ASCII 动作键。key字段包含一个值,表示事件发生在其中一个操作键上,其中包括12个功能键,箭头(光标)键,Page Up,Page Down,Home,End,Print Screen,Scroll Lock,Caps锁定,Num Lock,暂停和插入。- 另请参见:
- 常数字段值
-
MOUSE_DOWN
public static final int MOUSE_DOWN
Deprecated.用户按下了鼠标按钮。ALT_MASK标志表示已按下中间按钮。META_MASK标志表示已按下右键。
-
MOUSE_UP
public static final int MOUSE_UP
Deprecated.用户已释放鼠标按钮。ALT_MASK标志表示中间按钮已被释放。META_MASK标志表示右键已被释放。
-
MOUSE_MOVE
public static final int MOUSE_MOVE
Deprecated.鼠标移动时没有按下任何按钮。- 另请参见:
- 常数字段值
-
MOUSE_ENTER
public static final int MOUSE_ENTER
Deprecated.鼠标已进入组件。- 另请参见:
- 常数字段值
-
MOUSE_EXIT
public static final int MOUSE_EXIT
Deprecated.鼠标已退出组件。- 另请参见:
- 常数字段值
-
MOUSE_DRAG
public static final int MOUSE_DRAG
Deprecated.用户已按下按钮移动鼠标。ALT_MASK标志表示正在按下中间按钮。META_MASK标志表示正在按下右键。
-
SCROLL_LINE_UP
public static final int SCROLL_LINE_UP
Deprecated.用户已经激活的滚动条的 排队区域。- 另请参见:
- 常数字段值
-
SCROLL_LINE_DOWN
public static final int SCROLL_LINE_DOWN
Deprecated.用户已激活滚动条的 线下区域。- 另请参见:
- 常数字段值
-
SCROLL_PAGE_UP
public static final int SCROLL_PAGE_UP
Deprecated.用户已经激活了滚动条 上的 page up区域。- 另请参见:
- 常数字段值
-
SCROLL_PAGE_DOWN
public static final int SCROLL_PAGE_DOWN
Deprecated.用户激活滚动条的 向下翻页区域。- 另请参见:
- 常数字段值
-
SCROLL_ABSOLUTE
public static final int SCROLL_ABSOLUTE
Deprecated.用户已将气泡(拇指)移动到滚动条中,移动到“绝对”位置,而不是从最后位置偏移。- 另请参见:
- 常数字段值
-
SCROLL_BEGIN
public static final int SCROLL_BEGIN
Deprecated.滚动开始事件。- 另请参见:
- 常数字段值
-
SCROLL_END
public static final int SCROLL_END
Deprecated.滚动结束事件。- 另请参见:
- 常数字段值
-
LIST_SELECT
public static final int LIST_SELECT
Deprecated.已选择列表中的项目。- 另请参见:
- 常数字段值
-
LIST_DESELECT
public static final int LIST_DESELECT
Deprecated.已取消选择列表中的项目。- 另请参见:
- 常数字段值
-
ACTION_EVENT
public static final int ACTION_EVENT
Deprecated.此事件表示用户希望执行某些操作。- 另请参见:
- 常数字段值
-
LOAD_FILE
public static final int LOAD_FILE
Deprecated.文件加载事件。- 另请参见:
- 常数字段值
-
SAVE_FILE
public static final int SAVE_FILE
Deprecated.文件保存事件。- 另请参见:
- 常数字段值
-
GOT_FOCUS
public static final int GOT_FOCUS
Deprecated.一个组件获得了关注。- 另请参见:
- 常数字段值
-
LOST_FOCUS
public static final int LOST_FOCUS
Deprecated.一个组件失去了焦点。- 另请参见:
- 常数字段值
-
target
public Object target
Deprecated.目标组件。 这表示事件发生的事件或与事件关联的组件。 此对象已被AWTEvent.getSource()取代- 另请参见:
-
EventObject.getSource()
-
when
public long when
Deprecated.时间戳。 由InputEvent.getWhen()替换。- 另请参见:
-
InputEvent.getWhen()
-
id
public int id
Deprecated.指示事件的事件类型以及与事件相关的其他Event变量。 这已被AWTEvent.getID()取代- 另请参见:
-
AWTEvent.getID()
-
x
public int x
Deprecated.事件的x坐标。 由MouseEvent.getX()替换- 另请参见:
-
MouseEvent.getX()
-
y
public int y
Deprecated.事件的y坐标。 替换为MouseEvent.getY()- 另请参见:
-
MouseEvent.getY()
-
key
public int key
Deprecated.在键盘事件中按下的键的键代码。 这已被KeyEvent.getKeyCode()取代- 另请参见:
-
KeyEvent.getKeyCode()
-
modifiers
public int modifiers
Deprecated.修饰键的状态。 这被InputEvent.getModifiers()取代。在java 1.1中,MouseEvent和KeyEvent是InputEvent的子类。
-
clickCount
public int clickCount
Deprecated.对于MOUSE_DOWN事件,此字段指示连续点击次数。 对于其他事件,其值为0。 此字段已被MouseEvent.getClickCount()取代。
-
arg
public Object arg
Deprecated.事件的任意参数。 此字段的值取决于事件的类型。arg已被特定于事件的属性替换。
-
evt
public Event evt
Deprecated.下一个活动。 将事件放入链接列表时设置此字段。 这已被EventQueue取代。- 另请参见:
-
EventQueue
-
-
构造方法详细信息
-
Event
public Event(Object target, long when, int id, int x, int y, int key, int modifiers, Object arg)
Deprecated.注意:Event类已过时,仅可用于向后兼容。 它已被AWTEvent类及其子类所取代。使用指定的目标组件,时间戳,事件类型, x和y坐标,键盘键,修改键的状态和参数创建
Event的实例。- 参数
-
target- 目标组件。 -
when- 时间戳。 -
id- 事件类型。 -
x- x坐标。 -
y- y坐标。 -
key- 键盘事件中按下的键。 -
modifiers- 修饰键的状态。 -
arg- 指定的参数。
-
Event
public Event(Object target, long when, int id, int x, int y, int key, int modifiers)
Deprecated.注意:Event类已过时,仅可用于向后兼容。 它已被AWTEvent类及其子类所取代。创建
Event的实例,其中包含指定的目标组件,时间戳,事件类型, x和y坐标,键盘键,修饰键的状态以及设置为null的参数。- 参数
-
target- 目标组件。 -
when- 时间戳。 -
id- 事件类型。 -
x- x坐标。 -
y- y坐标。 -
key- 键盘事件中按下的键。 -
modifiers- 修饰键的状态。
-
-
方法详细信息
-
translate
public void translate(int dx, int dy)Deprecated.注意:Event类已过时,仅可用于向后兼容。 它已被AWTEvent类及其子类所取代。转换此事件,使其x和y坐标分别增加dx和dy 。
此方法转换相对于给定组件的事件。 这至少涉及将坐标转换为给定组件的局部坐标系。 它还可能涉及在暴露事件的情况下翻译区域。
- 参数
-
dx- 转换 x坐标的距离。 -
dy- 转换 y坐标的距离。
-
shiftDown
public boolean shiftDown()
Deprecated.注意:Event类已过时,仅可用于向后兼容。 它已被AWTEvent类及其子类所取代。检查Shift键是否已关闭。
- 结果
-
true如果密钥关闭; 否则为false。 - 另请参见:
-
modifiers,controlDown(),metaDown()
-
controlDown
public boolean controlDown()
Deprecated.注意:Event类已过时,仅可用于向后兼容。 它已被AWTEvent类及其子类取代。检查Control键是否已关闭。
- 结果
-
true如果密钥关闭; 否则为false。 - 另请参见:
-
modifiers,shiftDown(),metaDown()
-
metaDown
public boolean metaDown()
Deprecated.注意:Event类已过时,仅可用于向后兼容。 它已被AWTEvent类及其子类所取代。检查Meta键是否已关闭。
- 结果
-
true如果密钥关闭; 否则为false。 - 另请参见:
-
modifiers,shiftDown(),controlDown()
-
paramString
protected String paramString()
Deprecated.注意:Event类已过时,仅可用于向后兼容。 它已被AWTEvent类及其子类所取代。返回表示此
Event的状态的字符串。 此方法仅用于调试目的,返回字符串的内容和格式可能因实现而异。 返回的字符串可能为空,但可能不是null。- 结果
- 此事件的参数字符串
-
toString
public String toString()
Deprecated.注意:Event类已过时,仅可用于向后兼容。 它已被AWTEvent类及其子类所取代。以字符串形式返回此事件值的表示形式。
- 重写:
-
toString类Object - 结果
- 表示事件及其成员字段值的字符串。
- 从以下版本开始:
- 1.1
- 另请参见:
-
paramString()
-
-