










Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This document from the university of maryland, college park's computer science department covers event-driven programming, the model-view-controller pattern, gui elements, and java gui classes, including jtables. It also discusses design issues, event-driven programming in java, and the observer design pattern.
Typology: Study notes
1 / 18
This page cannot be seen from the preview
Don't miss anything!











Overview
Event-driven programming Model-View-Controller (MVC) Pattern GUI elements Java GUI classes JTables
Graphical User Interface (GUI) Goal Present information to users clearly & concisely Make interface easy to use for users Make software easy to implement / maintain forprogrammers Design issues Ease of use Ease of understanding Ability to convey information Maintainability Efficiency
Event-driven Programming Normal (control flow-based) programming Approach Start at main() Continue until end of program or exit() Event-driven programming Unable to predict time & occurrence of event Approach Start with main() Build GUI Await events (& perform associated computation)
Event-driven Programming in Java Example listeners & actions causing event^ ActionEvent
โโโโ^ clicking button in GUI CaretEvent
โโโโ^ selecting portion of text in GUI FocusEvent
โโโโ^ component gains / loses focus KeyEvent
pressing key ItemEvent
โโโโ^ selecting item from pull-down menu MouseEvent
โโโโ^ dragging mouse over widget TextEvent
โโโโ^ changing text within a field WindowEvent
โโโโ^ closing a window
Model-View-Controller (MVC) Pattern^ Developed at Xerox PARC in 1978^ Separates GUI into 3 components^ Model
โโโโ^ application data View^
โโโโ^ visual interface Controller
โโโโ^ user interaction Model
View Controller
MVC Pattern โ Advantages Separates data from its appearance More robust Easier to maintain Provides control over interface Easy to support multiple displays for samedata^ Model^ Model
MVC Pattern โ Model
MVC Pattern โ Controller
The Model View Controller Song Lyrics and music by James Dempsey. Model View, Model View, Model View ControllerMVC's the paradigm for factoring your code, into functional segmentsso your brain does not explode.To achieve reusability you gotta keep those boundaries clean, Modelon the one side, View on the other, the Controller's in between.Model View - It's got three layers like Oreos do.Model View creamy ControllerModel objects represent your applications raison dโere. Customclasses that contain data logic and et cetra.You create custom classes in your app's problem domain, then youcan choose to reuse them with all the views, but the model objectsstay the same
Principles of GUI Design
Do you have a good model? Could you reuse the model if you wanted toport the application to: a command-line textual interface an interface for the blind an iPod a web application, run on the web server, accessedvia a web browser