java事件响应

java

常用Java事件类、处理该事件的接口及接口中的方法

事件类/接口名称

接口方法及说明

ActionEvent动作事件类

ActionListener接口

actionPerformed(ActionEvent e)

单击按钮、选择菜单项或在文本框中按回车时

AdjustmentEvent调整事件类

AdjustmentListener接口

adjustmentValueChanged(AdjustmentEvent e)

当改变滚动条滑块位置时

ComponentEvent组件事件类

ComponentListener接口

componentMoved(ComponentEvent e)组件移动时

componentHidden(ComponentEvent e)组件隐藏时

componentResized(ComponentEvent e)组件缩放时

componentShown(ComponentEvent e)组件显示时

ContainerEvent容器事件类

ContainerListener接口

componentAdded(ContainerEvent e)添加组件时

componentRemoved(ContainerEvent e) 移除组件时

FocusEvent焦点事件类

FocusListener接口

focusGained(FocusEvent e)组件获得焦点时

focusLost(FocusEvent e)组件失去焦点时

ItemEvent选择事件类

ItemListener接口

itemStateChanged(ItemEvent e)

选择复选框、选项框、单击列表框、选中带复选框菜单时

KeyEvent键盘事件类

KeyListener接口

keyPressed(KeyEvent e)键按下时

keyReleased(KeyEvent e) 键释放时

keyTyped(KeyEvent e)击键时

MouseEvent鼠标事件类

MouseListener接口

mouseClicked(MouseEvent e) 单击鼠标时

mouseEntered(MouseEvent e)鼠标进入时

mouseExited(MouseEvent e)鼠标离开时

mousePressed(MouseEvent e)鼠标键按下时

mouseReleased(MouseEvent e) 鼠标键释放时

MouseEvent鼠标移动事件类

MouseMotionListener接口

mouseDragged(MouseEvent e)鼠标拖放时

mouseMoved(MouseEvent e)鼠标移动时

TextEvent文本事件类

TextListener接口

textValueChanged(TextEvent e)

文本框、多行文本框内容修改时

WindowEvent窗口事件类

WindowListener接口

windowOpened(WindowEvent e)窗口打开后

windowClosed(WindowEvent e)窗口关闭后

windowClosing(WindowEvent e)窗口关闭时

windowActivated(WindowEvent e)窗口激活时

windowDeactivated(WindowEvent e) 窗口失去焦点时

windowIconified(WindowEvent e)窗口最小化时

windowDeiconified(WindowEvent e) 最小化窗口还原时

 

 

文章摘自:http://blog.csdn.net/fxbgood/article/details/3451336

以上是 java事件响应 的全部内容, 来源链接: utcz.com/z/392321.html

回到顶部