captureMouse

captureMouse();

The captureMouse method of the Window class sets the mouse capture to the specified window for the application. When a window has captured the mouse, all mouse input is directed to that window, regardless of whether the cursor is positioned within the borders of that window. The mouse can be captured by only one window at a time by each application.

Use the releaseMouse method to release the mouse when the window no longer requires all mouse input.