go to previous page   go to home page   go to next page



Event-driven Programming

When you perform an action on a graphical component you generate an event. In event-driven programming the program responds to these events. The order of the events is determined by the user, not the program.

This is different from programs where user interaction is done through the console. In these programs, prompts are written to the console, and the user responds to the prompts. The order of the prompts is determined by the program.

For example, you can generate an event by clicking on this button:     Or you could click on this button:    Click on the buttons a few more times in any order. The program (your Web browser, in this case) is event-driven and responds to the events in whatever order you generate them.

If your browser is written in Java, then Swing components generate the events and Java methods respond to them. If your browser is written in C++, then it uses other components and methods, similar to Swing. (Most browsers are written in C++).


How do you imagine that I wrote this Web page: