go to previous page   go to home page   go to next page


Move your mouse pointer over the diagram. Does your browser ignore this event?

Maybe. Some browsers ignore this mouseOver event. Other browsers change the mouse pointer to show that there is a new set of options on a right-click. Most browsers show a tool tip for the image.

Move your mouse pointer over one of the buttons. Does your browser ignore this event?

Usually not. Most browsers change the mouse pointer from an arrow to a hand button for a mouseOver event on a button.

Of course, when you click the button that is another kind of event, and is not ignored.

Three Parts of a GUI Program

Radio as GUI

A GUI program has three parts:

  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.

The graphical components are Swing objects. You usually extend them to make them fit your application.

Listener methods are Java methods that you write. Listener methods respond to events by calling application methods.

Application methods are ordinary Java methods that perform useful computations. They receive data from the GUI and send data to the GUI to be displayed, but are not usually themselves concerned with the user interface.

Your Web browser has components (such as the "back" and "forward" buttons), listener methods that receive events (such as a click on the "back" button) and application methods that do useful things (such as moving backward or forward one page).

To write a GUI application, keep these three types of software separated (while keeping the big picture in mind). In a big software project an entire team of programmers is assigned to each of the tasks.


Consider a radio and its user interface. Match each part of the radio with its analogous part in a GUI application.

Radio Similar GUI Parts
Cabinet, speaker, control knobs, and dial.
Electronic parts directly connected to speaker, dial, and knobs.
Radio electronics and audio amplifier.