Disegno ed eventi

  • La gestione degli eventi prevede che il sistema invochi il metodo handleEvent(Event e) per ogni evento che coinvolge la nostra Applet
  • Il metodo standard handleEvent, a sua volta smista gli eventi, in base al tipo, ai seguenti metodi:
    • action() (Event.ACTION_EVENT)
    • mouseEnter() (Event.MOUSE_ENTER)
    • mouseExit() (Event.MOUSE_EXIT)
    • mouseMove() (Event.MOUSE_MOVE)
    • mouseDown() (Event.MOUSE_DOWN)
    • mouseDrag() (Event.MOUSE_DRAG)
    • mouseUp() (Event.MOUSE_UP)
    • keyDown() (Event.KEY_PRESS o Event.KEY_ACTION)
    • keyUp() (Event.KEY_RELEASE o Event.KEY_ACTION_RELEASE)
    • gotFocus() (Event.GOT_FOCUS)
    • lostFocus() (Event.LOST_FOCUS)
  • Il focus è relativo alla tastiera. La tastiera invia i suoi caratteri all'oggetto che possiede il focus
  • In genere l'oggetto che possiede il focus lo evidenzia in qualche modo grafico

© Ing. Stefano Salvi - All rights reserved