No matter which type of mouse listener, when a mouse event occurs, the information carried by the event is transmitted through mouseevent.
◆ E. Button: the ID of the mouse button, which is 0, 1, 2 from left to right. If you place the cursor in the left-hand direction, the cursor is arranged from right to left. This attribute is rarely used.
◆ E. statemask: the secondary key that is pressed when the mouse is used, which is the same as the secondary key used by the keyboard. Use the constant SWT. button_mask to determine whether the secondary key is used. For example:
If (E. statemask & SWT. button_mask) = 0 ){
System. Out. println ("no secondary key pressed ");
}
◆ E. X: The X coordinate of the mouse relative to the control that occurs when an event occurs. For example, in this example, the listener registers a button control instead of a window control, so when an event is obtained, the mouse is relative to the X coordinate of the button.
◆ E. Y: when an event occurs, the mouse is relative to the Y coordinate of the control in which the event occurs.