@Tag(value="label") public class Label extends HtmlContainer
<label> element.| Constructor and Description |
|---|
Label()
Creates a new empty label.
|
Label(String text)
Creates a new label with the given text content.
|
| Modifier and Type | Method and Description |
|---|---|
Optional<String> |
getFor()
Gets the id of the component that this label describes.
|
void |
setFor(Component forComponent)
Sets the component that this label describes.
|
void |
setFor(String forId)
Sets the id of the component that this label describes.
|
getTitle, setTitleaddListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getUI, hasListener, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, set, setElement, setId, setVisibleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitadd, add, addComponentAsFirst, addComponentAtIndex, remove, removeAllisEnabled, setEnabledgetElementgetHeight, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, setHeight, setHeightFull, setMaxHeight, setMaxWidth, setMinHeight, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidthFulladdClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameaddAttachListeneraddDetachListenerpublic Label()
public Label(String text)
text - the text contentpublic void setFor(Component forComponent)
The provided component must have an id set. This component will still use the old id if the id of the provided component is changed after this method has been called.
forComponent - the component that this label describes, not null
, must have an idIllegalArgumentException - if the provided component has no idpublic void setFor(String forId)
forId - the id of the described component, or null if
there is no valuepublic Optional<String> getFor()
setFor(String)Copyright © 2000–2019 Vaadin Ltd. All rights reserved.