Section 4.7 Chapter Summary
Subsection 4.7.1 Technical Terms
abstract class | input operation |
abstract interface | input stream |
abstract method | interface |
AWT | layout manager |
binary file | listener |
buffer | model-view-controller (MVC) architecture |
command-line interface | output operation |
container | output stream |
control element | stream |
event-driven programming | Swing |
event loop | text file |
graphical user interface (GUI) | top-level container |
helper method | user interface |
inheritance | wrapper class |
Subsection 4.7.2 Important Points
- An input operation is any action that transfers data from the user to the computer’s main memory via one of the computer’s input devices. An output operation is any action that transfers data from the computer’s main memory to one of the computer’s output devices.
- The user interface is that part of the program that handles the input and output interactions between the user and the program. As an interface, it limits or constrains the manner in which the user can interact with the program.
- In a command-line interface, user input is taken from the keyboard, and the program’s output is displayed on some kind of console.
- A buffer is a portion of main memory where input is held until it is needed by the program. Using a buffer between the keyboard and the program allows you to use the Backspace key to delete a character.
- A wrapper class contains methods for converting primitive data into objects and for converting data from one type to another.
- Designing appropriate prompts is an important aspect of designing a good user interface.
- I/O operations must watch out for certain types of I/O exceptions.
- GUI programming involves a computational model known as event-driven programming, which means that GUI programs react to events that are generated mostly by the user’s interactions with elements in the GUI.
- Java has two packages of GUIs, the older
java.awt
and the newerjavax.swing
. - Swing components are based on the object-oriented model-view-controller (MVC) architecture.
- The
extends
keyword is used to specify subclass/superclass relationships in the Java class hierarchy. - A top-level container is a GUI container that cannot be added to another container; it can only have components added to it. All GUI programs must be contained in a top-level container.
- There are generally three kinds of GUI components, corresponding to the three main functions of a user interface: input, output, and control.
- Events are handled by special objects called listeners. A listener is a specialist that listens constantly for a certain type of event.
- An interface is a special Java class that contains only methods and constants (final variables).
Solutions 4.7.3 Solutions to Self-Study Exercises
4.3 A Command-Line Interface
4.3.4 Designing a Command-Line Interface
Self-Study Exercises
4.4 A Graphical User Interface (GUI)
4.4.8 Using the GUI in a Java Application
Self-Study Exercises
4.4.8.1. GreeterGUI.
4.6 From the Java Library: java.io.File
and File Input (Optional)
4.6.1 File Input with the File
and Scanner
Classes
Self-Study Exercises
4.6.1.1. NumberFileReader.
You have attempted of activities on this page.