Skip to main content

continue mouseDragged even though mouse pointer reaches end of screen?

No replies
jarodrussell
Offline
Joined: 2010-05-19

Hello,

I'm trying to manipulate Java 2D transformations using Mouse Listeners, and I'm wondering if there is a better way.

<br />
public void mousePressed(MouseEvent e) {<br />
	startPoint = e.getPoint();<br />
}</p>
<p>public void mouseDragged(MouseEvent e) {<br />
	Point dragPoint = e.getPoint();<br />
	int deltaX = startPoint.x - dragPoint.x;<br />
	int deltaY = startPoint.y - dragPoint.y;</p>
<p>	// DO SOMETHING with deltaX and deltaY;</p>
<p>	startPoint = dragPoint;<br />
}<br />

Now the biggest problem I have is that once the mouse pointer reaches the end of my screen, there's no delta, and the transformations can't be further manipulated.

But I know of applications where the mousedrag continues even though the mouse pointer reached the end of the screen.

How can I do this?

Thanks in advance,
Jarod