Unformatted text preview:

Event loopsProgramming in prehistoric timesVery early interactive programsCommand-driven programs (20 years ago)Modern event-driven programsJava hides the event loopBuilding a GUIThe EndEvent loopsProgramming in prehistoric times•Earliest programs were all "batch" processing•There was no interaction with the userInputOutputProcessVery early interactive programs•BASIC was an early interactive language•Still a central computer, with terminals•Style of interaction was "filling out forms"Process inputAsk user for inputAsk user for inputProcess inputetc.Command-driven programs(20 years ago)•Allowing the user to enter "commands" was more flexible•Still only a single source of inputs•Not good enough for modern programsAsk user for commandRead and parsecommandExecute commandquitModern event-driven programs•Multiple sources of input–mouse clicks–keyboard–timers–external events•Requires a new program structureWait for eventDispatch eventQuitJava hides the event loop•The event loop is built into Java GUIs–GUI stands for Graphical User Interface•Interacting with a GUI component (such as a button) causes an event to occur•An Event is an object•You create Listeners for interesting events•The Listener gets the Event as a parameterBuilding a GUI•To build a GUI in Java,–Put some Components in a window–Add Listeners, usually one per Component–Put code in the Listeners to do whatever it is you want done•That's it!–Of course, there are a lot of details....The


View Full Document

UMBC CMSC 331 - Event loops

Documents in this Course
Semantics

Semantics

14 pages

Java

Java

12 pages

Java

Java

31 pages

V

V

46 pages

Semantics

Semantics

11 pages

Load more
Download Event loops
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Event loops and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Event loops 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?