Sensible Swing


This is an introduction to the most useful methods in the most useful Java classes. There is no attempt made to be complete. In fact, a deliberate attempt is made to omit classes or methods that should not be used, or are not often used.

Objects in a Graphical User Interface

Objects are used in a variety of ways in a graphical user interface. This web page discusses and demonstrates some of these uses.

Swing Applets and Applications

A Java program with a graphical user interface can be executed either as an applet or a stand-alone application. A stand-alone application is started up directly by the user by clicking on an icon or typing in a command to start the program. An applet is started up by a web browser when the user directs the browser to a URL that contains the applet.

Swing Components and Containers

Components are the building blocks of a graphical user interface. Containers hold groups of components so that they can be laid out together in a coherent way.

Swing Layout Management

Layout managers do the work of determining the size and location of components in a container.

Swing Graphics

In some applets or applications, it is useful to draw geometric figures of various kinds. Swing graphics gives you this capability.

Swing Listeners

Listeners are the Swing mechanism for defining how components respond to the user. One or more listener methods are invoked each time that a user event is created, with the event passed as a parameter.

Other Useful Classes

These are some other classes that are frequently used in an applet or application.