Event-driven
programming
With a graphical user interface, Java
makes use of a technique called event-driven programming. This means that when certain
events occur (e.g., the user clicks on a button, the mouse is moved, etc) then a
corresponding method is executed. You will already have seen this in the BallWorld
application, which had a method called paint. The program did not indicate when to execute this method; it is
executed whenever a repaint event occurs. The Java system knows when the display needs to be
updated, and generates this event automatically — for example when a window is
resized or revealed by the minimizing of another window. Events, and event-driven
programming, will be investigated later this module.

RITSEC - Global Campus
Copyright ?1999 RITSEC- Middlesex University. All rights reserved.
webmaster@globalcampus.com.eg
|