The Window is set to focus calls Window, Window focus means that the Window, or one of its subcomponents, will receive keyboard events.
void windowIconified(WindowEvent e)
Called when the icon of the window.
void windowLostFocus(WindowEvent e)
The Window is no longer the focused Window is called, is no longer the focused Window means that keyboard events are no longer delivered to the Window or any of its subcomponents.
void windowOpened(WindowEvent e)
Called when the window is open.
void windowStateChanged(WindowEvent e)
When the call to change the window state.
Keyboard events and their listener process.
Interface KeyListener
For receiving keyboard events (keystrokes) listener interface. The class is designed to handle keyboard events either implements this interface (and all the methods it contains) or extends the abstract KeyAdapter class (overriding only the method).
Then use the component's method addKeyListener listener object from that class is created registered with a component. Generate keyboard events when pressed, released, or typed keys. Then calls a listener method associated object and KeyEvent is passed to it.
Monitor and mouse event handling.
Mouse listener MouseListener
Listen for mouse events MouseEvent.
The corresponding event and processing methods
Mouse event handler method
MOUSE_CLICKED MouseClicked (MouseEvent) mouse click (single or double)
MOUSE_PRESSED MousePressed (MouseEvent) mouse down
MOUSE_RELEASED MouseReleased (MouseEvent) Release the mouse
MOUSE_ENTERED MouseEntered (MouseEvent) into the mouse (a component area)
MOUSE_EXITED MouseExited (MouseEvent) mouse leaves (a component area)
MouseEvent common method for mouse events
int getClickCount () obtained clicks 1 OR 2;
int getX (), int getY () obtained mouse (pixel) position.
Mouse listener MouseMotionListener
For the movement of the mouse and drag, further MouseMotionListener mouse motion listener.
Many programs do not need to listen for mouse movement, the two separate simplify procedures.
The corresponding event and processing methods
Mouse event handler method
MOUSE_MOVED MouseMoved (MouseEvent) mouse movement
MOUSE_DRAGGED MouseDragged (MouseEvent) mouse is dragged