当前位置: 技术问答>java相关
关于事件响应的问题????
来源: 互联网 发布时间:2015-03-23
本文导语: 各位大哥: 小弟想在同一事件响应中分步实现鼠标的按下、移动、释放,请问该怎么实现?? | 查查有关API,或. MouseListener ml = new MouseListener() { public void mousePressed(MouseEvent e) { ...
各位大哥:
小弟想在同一事件响应中分步实现鼠标的按下、移动、释放,请问该怎么实现??
小弟想在同一事件响应中分步实现鼠标的按下、移动、释放,请问该怎么实现??
|
查查有关API,或.
MouseListener ml = new MouseListener() {
public void mousePressed(MouseEvent e) {
...
}
public void mouseReleased(MouseEvent e) {
...
}
public void mouseClicked(MouseEvent e) {}
}
...
addMouseListener(ml);
MouseMotionListener mml = new MouseMotionListener() {
...
}
...
addMouseMotionListener(mml);
MouseListener ml = new MouseListener() {
public void mousePressed(MouseEvent e) {
...
}
public void mouseReleased(MouseEvent e) {
...
}
public void mouseClicked(MouseEvent e) {}
}
...
addMouseListener(ml);
MouseMotionListener mml = new MouseMotionListener() {
...
}
...
addMouseMotionListener(mml);