Sequential vs. Event-Driven Programming
Reacting to the user
Sequential programming GUI program organization Event-driven programming Modes
In sequential programs, the program is under control The user must synchronize with the program:
Program tells user it is ready for input User enters input and it is processed
Command-line prompts (DOS, UNIX) LISP interpreters
Shouldn’t the program be required to synchronize with the user?
Sequential Programming (2)
Flow of a typical sequential program
Prompt the user Read input from the keyboard Parse the input (determine user action) Evaluate the result Generate output Repeat
Prompt the user User input Output …show more content…
Let’s Say That Again…
When a key pressed event occurs on the enterArea component, the keyPressed method in our extended JFrame class will execute!
Signature for the keyPressed method: public void