CIS 35A: Introduction to Java Programming

Home | Green Sheet | Lectures | Assignments | FAQ | Grades

Swing

Swing
Objectives

Applied

  • Use the JFrame class to create and display an empty frame with a specified size and title, either at a specific position or centered on the screen.
  • Set the default close behavior of a frame.
  • Use the JPanel class to create a panel that contains labels, text fields, and buttons and add the panel to a frame.
  • Use the ActionListener interface to provide basic event handling for JButton components.
  • Use the FlowLayout and BorderLayout managers to control the layout of components on a panel.
  • Given the requirements for a program that uses the Swing features presented in this chapter, develop a program that satisfies the requirements.

Knowledge

  • Explain the difference between a frame and a panel.
  • Describe the characteristics of the following types of controls: labels, text fields, and buttons.
  • Describe the difference between AWT and Swing.
  • List the classes that are in the inheritance hierarchy for all Swing component classes.
  • Explain why it is necessary to set the default close behavior for a frame.
  • List the four panes that are present in every frame and identify the pane that contains components such as text fields, labels, and buttons.
  • Describe how button click events are handled in a Swing application.
  • Explain the role of layout managers in Swing development, and described the difference between the FlowLayout and BorderLayout layout managers.
| Introduction | Frames | Panels, buttons and events | Layout managers | Labels and text fields | Application