Event loops 16-Jun-18.

Slides:



Advertisements
Similar presentations
Chapter 18 Building the user interface. This chapter discusses n Javas graphical user interface. n Swing: an enhancement of a library called the Abstract.
Advertisements

An Introduction to Programming General Concepts. What is a program? A program is an algorithm expressed in a programming language. programming language.
Chapter 8 Improving the User Interface
Chapter 16 Graphical User Interfaces John Keyser’s Modifications of Slides by Bjarne Stroustrup
Graphic User Interfaces Layout Managers Event Handling.
C HAPTER 12 A Very Graphic Story. O VERVIEW Simple GUI Getting User Input Creating a Listener ActionEvents Displaying Graphics Drawing Multiple Buttons.
A graphical user interface (GUI) is a pictorial interface to a program. A good GUI can make programs easier to use by providing them with a consistent.
Chapter 7 Improving the User Interface
10.1 AWT The AWT classes Users today expect a Graphical User Interface (GUI) Improves application usability Difficult to implement cross-platform.
Graphical User Interfaces A Quick Outlook. Interface Many methods to create and “interface” with the user 2 most common interface methods: – Console –
David Streader Computer Science Victoria University of Wellington Copyright: David Streader, Victoria University of Wellington GUI and the UI API COMP.
Java Programming, 3e Concepts and Techniques Chapter 3 Section 65 – Manipulating Data Using Methods – Java Applet.
Welcome to CIS 083 ! Events CIS 068.
David Streader Computer Science Victoria University of Wellington Copyright: David Streader, Victoria University of Wellington While loops and the UI API.
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
Event Driven Programming
Java Software Solutions Lewis and Loftus Chapter 10 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Graphical User Interfaces --
Lecture 5: Interaction 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 711,  ex 2271 
1 Event Driven Programs Rick Mercer. 2 So what happens next?  You can layout a real pretty GUI  You can click on buttons, enter text into a text field,
C H A P T E R T E N Event-Driven Programming Programming Languages – Principles and Paradigms by Allen Tucker, Robert Noonan.
Dale Roberts GUI Programming using Java - Event Handling Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.
Ch 3-4: GUI Basics Java Software Solutions Foundations of Program Design Sixth Edition by Lewis & Loftus Coming up: GUI Components.
 2002 Prentice Hall, Inc. All rights reserved Introduction Graphical User Interface (GUI) –Gives program distinctive “look” and “feel” –Provides.
Creating Graphical User Interfaces (GUI’s) with MATLAB By Jeffrey A. Webb OSU Gateway Coalition Member.
Timer class and inner classes. Processing timer events Timer is part of javax.swing helps manage activity over time Use it to set up a timer to generate.
Concurrent Programming and Threads Threads Blocking a User Interface.
Java Applets: GUI Components, Events, Etc. Ralph Westfall June, 2010.
CS324e - Elements of Graphics and Visualization Java GUIs - Event Handling.
Graphical User Interface You will be used to using programs that have a graphical user interface (GUI). So far you have been writing programs that have.
CITA 342 Section 2 Visual Programming. Allows the use of visual expressions (such as graphics, drawings, or animation) in the process of programming.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Object Oriented Programming.  Interface  Event Handling.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 13 GUI Programming.
GUI Programming Joseph Sant Sheridan College. Agenda Elements of GUI programming Component-Based Programming. Event-Based Programming. A process using.
GUIs Basic Concepts. GUI GUI : Graphical User Interface Window/Frame : a window on the screen Controls/Widgets : GUI components.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 4: Events Programming with Alice and Java First Edition by John Lewis.
1 Event Driven Programs Rick Mercer. 2 So what happens next?  You can layout a real pretty GUI  You can click on buttons, enter text into a text field,
1 Lecture 8: User Interface Components with Swing.
12-Jun-16 Event loops. 2 Programming in prehistoric times Earliest programs were all “batch” processing There was no interaction with the user Input Output.
Programming Logic and Design Seventh Edition Chapter 12 Event-Driven GUI Programming, Multithreading, and Animation.
GUI Programming using Java - Event Handling
Topics Graphical User Interfaces Using the tkinter Module
Event Loops and GUI Intro2CS – weeks
Chapter Topics 15.1 Graphical User Interfaces
Event-driven programming
Processing Timer Events
Event Driven Programming Dick Steflik
An Introduction to Programming
Ellen Walker Hiram College
Chap 7. Building Java Graphical User Interfaces
Graphical User Interfaces -- Introduction
Event Driven Programming
EE 422C Java FX.
Timer class and inner classes
Basic Elements of The GUI
Introduction to Computing Using Java
Event loops.
Event Driven Programming
Event loops 17-Jan-19.
Event loops 17-Jan-19.
Computer Science 111 Fundamentals of Programming I User Interfaces
Chapter 15: GUI Applications & Event-Driven Programming
Event loops 8-Apr-19.
An Introduction to Programming
HTML and CSS Basics.
Event loops.
ACM programming contest
Event loops.
Event loops 19-Aug-19.
Presentation transcript:

Event loops 16-Jun-18

Programming in prehistoric times Earliest programs were all “batch” processing There was no interaction with the user Input Output Process

Very early interactive programs BASIC was an early interactive language Still a central computer, with terminals Style of interaction was “filling out forms” Process input Ask user for input etc.

Command-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 programs Ask user for command Read and parse command Execute command quit

Modern event-driven programs Multiple sources of input mouse clicks keyboard timers external events A new program structure is required Wait for event Dispatch event Quit

Java 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 parameter

Building a GUI To build a GUI in Java, That's it! 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....

Vocabulary 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)

Vocabulary 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 occurs

The End