What are the three parts of a GUI program?

A good answer might be:

  1. Graphical Components that make up the Graphical User Interface.
  2. Listener methods that receive the events and respond to them.
  3. Application methods that do useful work for the user.


Let's start with the graphical components. These must be placed inside a container. Visually, a container is a rectangular area of the monitor screen and its components are smaller areas within it.

In Java, a frame is a window that has nice borders, various buttons along the top border, and other built in things. What you usually call a "window" Java calls a "frame". A frame is a container object, so GUI components can be placed in it.

Like all software objects, a frame object is actually a section of main memory that holds information and methods. With the help of the operating system and the graphics board, Java paints a picture on the computer monitor that represents the frame. People often speak as if the frame were the actual picture on the monitor. In fact, what you see on the monitor is just a graphical representation of the frame.

GUI application programs are usually organized around one or more frames.


What is the name of the Swing class that is used for frames?