private void updateImage ( ) { if ( ! over ) { currentImage = normalImage ; currentColor = normalColor ; state = NORMAL ; mouseUp = false ; } else { if ( mouseDown ) { if ( ( state != MOUSE_DOWN ) && ( mouseUp ) ) { if ( mouseDownSound != null ) { mouseDownSound . play ( ) ; } currentImage = mouseDownImage ; currentColor = mouseDownColor ; state = MOUSE_DOWN ; notifyListeners ( ) ; mouseUp = false ; } return ; } else { mouseUp = true ; if ( state != MOUSE_OVER ) { if ( mouseOverSound != null ) { mouseOverSound . play ( ) ; } currentImage = mouseOverImage ; currentColor = mouseOverColor ; state = MOUSE_OVER ; } } } mouseDown = false ; state = NORMAL ; }
Update the current normalImage based on the mouse state