Section 4.7 Chapter Summary
Subsection 4.7.1 Technical Terms
|abstract class||input operation|
|abstract interface||input stream|
|buffer||model-view-controller (MVC) architecture|
|command-line interface||output operation|
|event loop||text file|
|graphical user interface (GUI)||top-level container|
|helper method||user interface|
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.awtand the newer
Swing components are based on the object-oriented model-view-controller (MVC) architecture.
extendskeyword 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).