Sensible Swing


Introduction

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.

The web pages below use a JavaScript library to give a menued presentation format to the information. This library does not yet work in Internet Explorer. It works without limitation in Chrome, Firefox, and Safari.

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 Components

Components are the building blocks of a graphical user interface.

Swing Containers

Containers hold groups of components so that they can be laid out together in a coherent way. Containers are also components. This lets you create complex hierarchies of components and containers.

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 Layout

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

Events are Swing objects that mediate user actions. Whenever the user moves the mouse, clicks on a mouse button, or types at the keyboard, an event is generated that captures information about the user's action.

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.