Labels

Labels are used with a number of different components. As the name implies, they provide a means to attach a heading to an interface component. Consequently, they are frequently used with a number of different components.

Defining a label involves simply supplying the text string to be shown and, optionally, an alignment integer (i.e., CENTER, LEFT, or RIGHT. The value of the label may provided thorough the constructor or later using Label's setText method.

See the Label class in the java.awt package.

Examples:

Label title = new Label ( "Personal Information", Label.CENTER);