DOC PREVIEW
Penn CIT 591 - Event loops

This preview shows page 1-2-3 out of 10 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 10 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 10 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 10 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 10 pages.
Access to all documents
Download any document
Ad free experience

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 GUIVocabulary IVocabulary IIThe EndJan 14, 2019Event loops2Programming in prehistoric timesEarliest programs were all “batch” processingThere was no interaction with the userInputOutputProcess3Very 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.4Command-driven programs(20 years ago)Allow the user to enter “commands” Much more flexibleStill only a single source of inputsNot good enough for modern programsAsk user for commandRead and parsecommandExecute commandquit5Modern event-driven programsMultiple sources of inputmouse clickskeyboardtimersexternal eventsA new program structure is requiredWait for eventDispatch eventQuit6Java 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 parameter7Building a GUITo build a GUI in Java,Create some ComponentsUse a layout manager to arrange the 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....8Vocabulary IEvent – an object representing an external happening that can be observed by the programevent-driven programming – A style of programming where the main thing the program does is respond to Eventsevent loop – a loop that waits for an Event to occur, then dispatches it to the appropriate codeGUI – a Graphical User Interface (user interacts with the program via things on the screen)9Vocabulary IIComponent – an interface element, such as a Button or a TextFieldLayout Manager – an object (provided by Java) that arranges your Components in a windowListener – an object you create to execute some code appropriate when an Event occurs10The


View Full Document

Penn CIT 591 - Event loops

Documents in this Course
Stacks

Stacks

11 pages

Arrays

Arrays

30 pages

Arrays

Arrays

29 pages

Applets

Applets

24 pages

Style

Style

33 pages

JUnit

JUnit

23 pages

Java

Java

32 pages

Access

Access

18 pages

Methods

Methods

29 pages

Arrays

Arrays

32 pages

Methods

Methods

9 pages

Methods

Methods

29 pages

Vectors

Vectors

14 pages

Eclipse

Eclipse

23 pages

Vectors

Vectors

14 pages

Recursion

Recursion

24 pages

Animation

Animation

18 pages

Animation

Animation

18 pages

Static

Static

12 pages

Eclipse

Eclipse

23 pages

JAVA

JAVA

24 pages

Arrays

Arrays

29 pages

Animation

Animation

18 pages

Numbers

Numbers

21 pages

JUnit

JUnit

23 pages

Access

Access

18 pages

Applets

Applets

24 pages

Methods

Methods

30 pages

Buttons

Buttons

20 pages

Java

Java

31 pages

Style

Style

28 pages

Style

Style

28 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?