Document 7675892

Download Report

Transcript Document 7675892

Introduction to GUI Programming
• Learning Outcomes
o Explain the motivation for, and usefulness of GUIs.
o List and explain seven principles of good GUI design and their
benefits.
o Discuss what GUI programming involves, and explain how
Java's GUI library evolved.
• Introduction to User Interfaces
• GUI Design Issues
• GUI Programming Issues
• Self-check Exercise
• Java GUI Library Evolution
• Exercises
Unit 10
1
Introduction to User Interfaces
• A user interface (UI) is that part of a program that interacts with the user
• A user interface can be based on text or graphics.
• In a text-based UI the commands are entered from the keyboard.
• In a graphical UI the user interacts with GUI objects.
• In a console program, the system usually
controls user actions.
• In GUI programs, the user controls the
behavior of the program.
• Thus, GUI programs give more control to the user.
Unit 10
2
Principles of GUI Design
• Give time for GUI design and integration.
• Have a simple and clear layout.
• Use graphics objects and terminology
consistently.
• Be functionally intuitive and visually
attractive.
• Provide visual and audible feedback.
• Be responsive.
• Be flexible and customizable.
Unit 10
3
Benefits of Good GUIs
• Facilitate higher user productivity and lower long-term costs.
• Improve integrity of underlying application.
• Improve the reliability and safety of mission-critical
applications.
• Improve user confidence.
• Make software more marketable.
Unit 10
4
GUI Programming Issues
•
What do I need to know to write good GUI applications?
•
Writing GUI applications requires knowledge of:
1. Graphics
2. Media
3. Windows
4. Events
5. Multithreading
Unit 10
5
Java GUI API Evolution
• Java provides classes representing UI items like windows,
buttons, menus etc.
• The GUI toolkit in older versions of Java is called AWT.
• An enriched version the toolkit, Swing, was developed in
later versions of Java.
• AWT and Swing are part of the
Java Foundation Classes (JFC).
• Why was Swing developed in addition to AWT?
Unit 10
6
Java GUI API Evolution (cont'd)
• Programs using AWT components are multi-platform.
• However, GUI components in AWT are abstract and rely on
native peers.
• By relying on native peers, AWT components are limited:
• slow on some platforms.
• portability problems.
• Unlike AWT, Swing components
are rendered and controlled by the JVM.
Unit 10
7
Review Exercises
1.
Explain the advantages of graphics-based over text-based user
interfaces.
2.
What is a good and effective GUI? Why is it necessary to design GUI
for all on-trivial applications? Explain..
3.
Explain the implications of good as well as badly designed GUIs.
4.
What is JFC? What Swing? Why was the JFC enriched with Swing?
5.
AWT components are said to be heavy weight while Swing
components are said to be light weight. Explain what these notions
mean.
6.
Enumerate the major knowledge units that must be understood for
developing effective GUI applications. Briefly explain each of these
knowledge units.
Unit 10
8