Home | Amazing | Today | Tags | Publishers | Years | Account | Search 
Event-Driven Programming

Buy
Event-Driven Programming, 9780749219925 (0749219920), Open University Press, 2009
The previous unit, Unit 6, has shown you how to create graphical user interfaces that contain a wide range of components and have quite sophisticated layouts. You are also in a position now to make use of Java reference material to investigate and use other components and layouts. However, when the user clicks on a button or enters text, nothing happens. This is because there is no link between the graphical user interface and the code that you would like to be executed.

Creating this link between something happening in the graphical user interface – an event – and the execution of code is the subject of this unit. This subject is commonly known as event-driven programming. Event-driven programs are programs that respond to events initiated by the user, such as mouse clicks and key presses. Events can also be initiated through software coding, using for example the Timer class, which may specify that certain events are to take place at certain times. However, this course will consider only user-initiated events.

Event-driven programming represents an entirely different style of programming. All of the code that you have worked on so far has been fairly 'linear' in nature – it has been possible to plot a route through the code to show the order of execution. However, with event-driven programming this is no longer necessarily the case. Essentially, components are waiting around for an outside body – the user – to initiate an event through one of the visual components – clicking a button, for example. But you, the programmer, do not know when the button will be pressed, whether a number of buttons will be pressed, or in which order the user will press them.

You will see that a major part of event-driven programming is the creation of objects called listeners that are attached to components. As their name suggests they 'listen' for events happening to 'their' components. These listeners then 'fire' off the desired code. Listeners can be 'told' to look at particular components and to look only at particular events. For example, a listener may be interested only in a mouse entering a particular part of the screen and not in it being clicked.

We will also continue with the Calculator example started in the last unit. In this unit we show how the action of the user clicking on a button can be linked to the code that will carry out the actions and then display the result.
(HTML tags aren't allowed.)

Optimizing Windows 7 Pocket Consultant
Optimizing Windows 7 Pocket Consultant

Portable and precise, this pocket-sized guide delivers ready answers for optimizing the performance of your Windows 7-based PC. Zero in on core tuning, customization, and troubleshooting tasks using quick-reference tables, instructions, and lists. Topics include system boot and startup, software and hardware, search and indexing, system...

Polymorphism in Java: Methods and polymorphic algorithms applied to computer games
Polymorphism in Java: Methods and polymorphic algorithms applied to computer games
The creation of polymorphic algorithms is a necessary skill for programmers who intend to write reusable code. This book stands out for teaching programming based on polymorphism. Abundant examples in Java code and illustrative graphics of the main ideas related to the topic: Polymorphism in Java. The book "Polymorphism in Java" aims...
Managing Security Overseas: Protecting Employees and Assets in Volatile Regions
Managing Security Overseas: Protecting Employees and Assets in Volatile Regions
Written by a Certified Protection Professional (CPP), Certified Fraud Examiner (CFE), and FBI recognized subject matter expert, Managing Security Overseas: Protecting Employees and Assets in Volatile Regions details the dos and don’ts of protecting people and assets in hostile global settings. The author, Scott Alan Ast,...

Iterative UML Development Using Visual C++ 6.0
Iterative UML Development Using Visual C++ 6.0
When we first endeavored to understand object-oriented development, we read the usual books, subscribed to the typical newsgroups on the Internet, and read many publications. We found great volumes of information inapplicable for the average, chaotic pace of software development. Mostly, it was too theoretical for our taste. Each author had a...
Online Marketing Inside Out (Online Marketing: Sitepoint)
Online Marketing Inside Out (Online Marketing: Sitepoint)

Online Marketing Inside Out is an invaluable book for anyone wanting to market products or services online - whether or not marketing is part of your job description. Small-business entrepreneurs and web-site owners will benefit from this information-packed book, as will traditional marketers with little or no experience of online...

Engineering Documentation Control Handbook, 3rd Edition
Engineering Documentation Control Handbook, 3rd Edition
The wide acceptance of this book has been very gratifying. This work seems to have taken on a life of its own. The publisher wrote: “Your book over the last year has resulted in the most ‘Buy This Book’ links of our entire catalog … It is very well received by the ‘Googleites.’ ” Sales have exceeded 10,000...
©2019 LearnIT (support@pdfchm.net) - Privacy Policy