Mouse, keyboard, monitor

contentPane.addMouseListener(new Mouseadapter() {

});

// MouseAdapter is a realization of the abstract class for all mouse interfaces 
// what methods just need to override the method needs to be on it

Where the mouse listener has the following methods:

mousePressed () occurs when the user presses the mouse button.
the mouseReleased () occurs when the user releases the mouse button.
mouseClicked () occurs when a user presses and releases the mouse button or double-click the icon to select the user in time will usually click on the mouse button. If the user moves the mouse before releasing the mouse, click the mouse does not result in a corresponding event.

mouseEntered () to activate event when the mouse leaves the current assembly and into the component you are listening.
the mouseExited () occurs when the mouse leaves the component you are listening.
() when the user presses the mouse button and move before the release time mouseDragged occurs in mouseDragged release (after) the mouse does not result in the mouseClicked ().
the mouseMoved () occurs when the mouse moved without dragging on the component.
occurs when the roller slides mouseWheelMoved, by e.getWheeltion () is the known roller slide forward or backward slip

 

Keyboard monitor:

txtInput.addKeyListener(new KeyAdapter(){

});
// and mouse listener as KeyAdapter () method What you need to go rewrite

KeyTyped triggered when you enter a word

Release the trigger when KeyReleased keyboard

Press the trigger when KeyPressed keyboard

All keys on the keyboard, has a specific encoding such as carriage of static constant KeyEvent.VK_ENTER

setMnemonic keyboard mnemonic may be provided on the current magic

Guess you like

Origin www.cnblogs.com/zhuhaorong/p/12063346.html