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
, orRIGHT
. The value of the label may provided thorough the constructor or later usingLabel's setText
method.Examples:
Label title = new Label ( "Personal Information", Label.CENTER);