Creating custom fields with labels to display in FormLayout

How do we create custom fields with labels to show in FormLayout?

For example, Assuming that we want to create a custom field by extending AbstractCompositeField. If the content (return value of initContent()) of this field is an existing Vaadin field (like TextField), it displays the label from that field. If this is not the case (for example, if it is a HorizontalLayout), how do we set a label so that it will be displayed as a label in FormLayout?