Mouse issues?

I’m wondering if there’s a way via AWT to generate repeteadily the mousePressed event till a mouse button remains pressed (to scroll a screen clicking at the edges, for example).

I’m convinced that it should be a solution to continously fire an event when a mouse button is down. Simply I canno reach it myself… :stuck_out_tongue:

Any hints to share?

when mousePressed is called, set a boolean to true. When mouseReleased is called, set that boolean to false. Check that boolean to determine whether or not to fire the mouse

I wasn’t so clear so forgive me…

The game is a passive rendered GUI-based one, that’s the problem.
I’ve implemented a thread to start when the user press the mouse and to stop when it will release it that has only the purpose to update the scrolling coordinates of the map and refresh it, but is a cumbersome solution for a such basic GUI feature.
I’m convinced that out there should be a better solution for passive rendering applications.

Just because you’re rendering passively doesn’t mean your main logic Thread isn’t going to be running continuously. Set the boolean like I suggested, and have your logic Thread inform your code when to update the graphics.

Rather than start a thread you could use a swing timer. That will give you repeating events like you want.

wow swpalmer nice hint!

sometimes the simplest solutions are the ones no-one will think about it.