The type of user interface covered in this chapter is called a graphical user interface (GUI).
GUI objects in the javax.swing package are collectively called Swing classes.
To program the customized user interface effectively, we must learn a new style of programming control called event-driven programming.
The GUI and related classes and interfaces introduced in this chapter are JFrame Container
JFrame
Container
JButton
ImageIcon
ActionListener
BorderFactory
ActionEvent
JScrollPane
JLabel
JMenuBar
JTextField
JMenu
JTextArea
JMenuItem
We often define a subclass of JFrame as the top-level main window of a program.
Asubclass is defined by using inheritance.
GUI objects such as buttons and text fields are placed on the content p ane of a frame window.
The layout manager determines the placement of the GUI objects.
GUI objects can be placed on the content pane without using any layout manager. Such placement is called absolute positioning.
Event handling is divided into event sources and event listeners. Event sources generate events, and event listeners include a method that gets executed in response to the generated events.
The most common event type is called an action event.
We can find out the class to which an object belongs by using the instanceof operator.
We use an instance of JButton to represent a pushbutton on a frame. JButton objects generate action events.
GUI objects dealing with text are JLabel, JTextfield, and JTextArea. JTextField objects generate action events.
AJLabel object can include an image of type ImageIcon.
AJava interface is a reference data type that includes only constants and abstract methods.
Aframe has one JMenuBar object. A single JMenuBar can have many JMenu objects with many JMenuItem objects associated to a single JMenu object.