Skip to content

Label

Text caption widget associated with an interactive focus target control or form input.

Overview

Label displays single-line or wrapped text captions. When clicked, it automatically transfers input focus to its associated focusTarget control (such as a TextField or Checkbox), improving form accessibility.

Associated Form Label

TextField nameInput = new TextField();
Label nameLabel = new Label("Username:")
        .labeledControl(nameInput);

API

Label::color(ColorView)

Set Text Color

Sets foreground text color.

Parameter Type Description
color ColorView —

Returns Label.

Label::focusTarget(Widget)

Focus Target

Returns or sets widget receiving focus when label is clicked.

Parameter Type Description
focusTarget Widget —

Returns Label.

Label::labeledControl(Widget)

Set Labeled Control

Associates control as focus target and sets label relationship.

Parameter Type Description
control Widget —

Returns Label.

Label::textAlignment(Alignment)

Set Text Alignment

Sets horizontal alignment of label text within bounds.

Parameter Type Description
alignment Alignment —

Returns Label.

Label::wrap(boolean)

Set Text Wrapping

Enables or disables automatic multi-line text wrapping.

Parameter Type Description
wrap boolean —

Returns Label.