public class Text extends Component implements HasText
Text node doesn't support setting any attribute or property so you may not
use Element API (and Text doesn't provide any such contract) for
setting attribute/property. It implies that you may not style this component
as well. Any attempt to set attribute/property value throws an exception. The
only available API for a Text component is set a text.
If you need a text component which can be styled then check Span
class (from flow-html-components) module.
| Constructor and Description |
|---|
Text(String text)
Creates an instance using the given text.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getText()
Gets the text of the component.
|
protected <T> void |
set(PropertyDescriptor<T,?> descriptor,
T value)
Sets the value of the given component property.
|
void |
setId(String id)
The method is not supported for the
Text class. |
void |
setText(String text)
Sets the text of the component.
|
void |
setVisible(boolean visible)
The method is not supported for the
Text class. |
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, setElementclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetElementaddAttachListeneraddDetachListenerpublic Text(String text)
text - the text to show, null is interpreted as an empty
stringpublic void setText(String text)
public String getText()
protected <T> void set(PropertyDescriptor<T,?> descriptor, T value)
Componentset in class ComponentT - type of the value to setdescriptor - the descriptor for the property to set, not nullvalue - the new property value to setPropertyDescriptorpublic void setId(String id)
Text class.
Always throws an UnsupportedOperationException.
setId in class Componentid - the id to set, or "" to remove any previously set
idUnsupportedOperationExceptionpublic void setVisible(boolean visible)
Text class.
Always throws an UnsupportedOperationException.
setVisible in class Componentvisible - the component visibility valueUnsupportedOperationExceptionCopyright © 2025. All rights reserved.