Class Text
java.lang.Object
com.vaadin.flow.component.svg.elements.SvgElement
com.vaadin.flow.component.svg.elements.Text
Represents an SVG text element.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the current font family used for this Text element.Returns the font size for this text element.getText()Returns the current text on this text element.voidsetFontFamily(String fontFamily) Sets the font family to use for this Text element.voidsetFontSize(String fontSize) Sets the font size of this text element, this can be in absolute (px) or relative (ex: em, ex) values.voidSets the visible text for this Text element.Methods inherited from class com.vaadin.flow.component.svg.elements.SvgElement
addClassName, clearUpdates, cloneAttributesToJson, createArgArray, flip, getAttribute, getAttributes, getBooleanAttribute, getFillColor, getId, getNumberAttribute, getStringAttribute, getUnsafeAttributesMap, getUpdates, isDraggable, move, pushUpdate, removeClassName, rotate, setAttribute, setAttribute, setAttribute, setAttribute, setAttributes, setConstructor, setDraggable, setFillColor, setId, setPosition, setStroke, setStroke, size, val, val, val
-
Constructor Details
-
Text
Creates a new Text element with the given id and text.- Parameters:
id- the id for this text elementtext- the text to show for this text element
-
-
Method Details
-
setText
Sets the visible text for this Text element.- Parameters:
text- the text to show
-
getText
Returns the current text on this text element.- Returns:
- the current text on this text element.
-
setFontFamily
Sets the font family to use for this Text element. Note that the browser must support the font that is specified here.This attribute can have multiple values (i.e. webfonts with fallback) for instance: setFontFamily("'Roboto', 'Noto', sans-serif");
- Parameters:
fontFamily- the font family to use for this text element.
-
getFontFamily
Returns the current font family used for this Text element.- Returns:
- the current font family
-
setFontSize
Sets the font size of this text element, this can be in absolute (px) or relative (ex: em, ex) values.- Parameters:
fontSize- the font size to use
-
getFontSize
Returns the font size for this text element.- Returns:
- the font size or null if none set
-