I'm currently implementing a mousehover script in Java for a button with full graphics (no JButton). here's my piece of code:
@Override
public void mouseMoved(MouseEvent e){
if (btnExit.getBound().contains(e.getX(), e.getY())){
btnExit.setStatus(BUTTON_STATE.HOVER);
} else {
btnExit.setStatus(BUTTON_STATE.IDLE);
}
System.getInstance().repaint();
}
the repaint method is always called when my mouse moves.
The question is > is it a good implementation for the hover action? or are there better implementations? because I thought that calling repaint() everytime my mouse move is quite heavy in computation.
THX b4