Hi,
I'm trying to make my java app repaint each time the mouse has been moved to update the screen when the user moved over a diagram ( -> display the name of the diagram ) and when the user does not move over a diagram ( -> do not display any name of a diagram ). But this causes a huge lag when running the application ( I see the screen been repainted very slow, laggy, the screen is white empty for like a second each time before it's repainted; takes long to repaint ).
These are the the parts of the code which it's about:
public void mouseMoved(MouseEvent e) {
this.checkDiagramHovered(e.getX(),e.getY());
}
Which calls to a function that checks whether diagram was hovered and set variables whether a diagram was hovered and if so: which diagram was hovered (name to display, x and y position to do) and then repaint the app. So it basicly repaints the app each time a mousemovement was made to be sure it displays the name of a diagram ONLY when the user moved over it. But this causes the screen to lag a lot, choppy repainting.
Now I was wondering: what's the best way to solve this? Should I implement some kind of delay for checking the mousemovement or something if that can be done?
Thanks in advance,
Skyfe.