接口 DrawListener
-
public interface DrawListener
DrawListener. This interface provides a basic capability for responding to keyboard in mouse events fromDraw
via callbacks. You can see some examples in Section 3.6.For additional documentation, see Section 3.1 of Computer Science: An Interdisciplinary Approach by Robert Sedgewick and Kevin Wayne.
-
-
方法概要
修饰符和类型 方法 说明 void
keyPressed(int keycode)
Invoked when a key has been pressed.void
keyReleased(int keycode)
Invoked when a key has been released.void
keyTyped(char c)
Invoked when a key has been typed.void
mouseClicked(double x, double y)
Invoked when the mouse has been clicked (pressed and released).void
mouseDragged(double x, double y)
Invoked when the mouse has been dragged.void
mousePressed(double x, double y)
Invoked when the mouse has been pressed.void
mouseReleased(double x, double y)
Invoked when the mouse has been released.
-
-
-
方法详细资料
-
mousePressed
void mousePressed(double x, double y)
Invoked when the mouse has been pressed.- 参数:
x
- the x-coordinate of the mousey
- the y-coordinate of the mouse
-
mouseDragged
void mouseDragged(double x, double y)
Invoked when the mouse has been dragged.- 参数:
x
- the x-coordinate of the mousey
- the y-coordinate of the mouse
-
mouseReleased
void mouseReleased(double x, double y)
Invoked when the mouse has been released.- 参数:
x
- the x-coordinate of the mousey
- the y-coordinate of the mouse
-
mouseClicked
void mouseClicked(double x, double y)
Invoked when the mouse has been clicked (pressed and released).- 参数:
x
- the x-coordinate of the mousey
- the y-coordinate of the mouse
-
keyTyped
void keyTyped(char c)
Invoked when a key has been typed.- 参数:
c
- the character typed
-
keyPressed
void keyPressed(int keycode)
Invoked when a key has been pressed.- 参数:
keycode
- the key combination pressed
-
keyReleased
void keyReleased(int keycode)
Invoked when a key has been released.- 参数:
keycode
- the key combination released
-
-