PPT Slide
Debugging re: Event Handlers
- Debugging an event-driven program (whether applet or graphical application) is more tricky than debugging a non-event-driven program.
- With an event-driven Java program, you don't explicitly code any kind of event-handling loop that "polls" for occurring events, then calls the appropriate handler(s) for those events.
- Instead, the Java internals handle this polling action for you. Debugging becomes trickier because now you have to make sure that your event handling code works correctly.
- You also have to make sure you're handling the
correct events in the first place! For example,
your code for mouseEntered( ) may work perfectly,
but if you're expecting it to get called when the user clicks a mouse button, it won't be!