接口 DrawListener
-
public interface DrawListenerDrawListener. This interface provides a basic capability for responding to keyboard in mouse events fromDrawvia 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.
-
-
方法概要
修饰符和类型 方法 说明 voidkeyPressed(int keycode)Invoked when a key has been pressed.voidkeyReleased(int keycode)Invoked when a key has been released.voidkeyTyped(char c)Invoked when a key has been typed.voidmouseClicked(double x, double y)Invoked when the mouse has been clicked (pressed and released).voidmouseDragged(double x, double y)Invoked when the mouse has been dragged.voidmousePressed(double x, double y)Invoked when the mouse has been pressed.voidmouseReleased(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
-
-