开发者

How would I allow the user to move the view when they move the mouse off screen?

开发者 https://www.devze.com 2023-01-15 23:45 出处:网络
I would implement the vi开发者_高级运维ew moving, I just need to know if the mouse is offscreen (offwindow) and adjust the offset variables accordingly.Maybe you can use a MouseListener to listen for

I would implement the vi开发者_高级运维ew moving, I just need to know if the mouse is offscreen (offwindow) and adjust the offset variables accordingly.


Maybe you can use a MouseListener to listen for the mouseExited event. Then you can use the MouseInfo class to get the current location of the mouse and then reset the location of the window accordingly.

If the mouse is moving too fast, the mouse may still be outside the window after you reset the location so maybe you will need to start a Timer to continually check the MouseInfo to get the current mouse location and then continually adjust the window location. If at any time a mouseEntered event is generated then you can stop the Timer.

0

精彩评论

暂无评论...
验证码 换一张
取 消