TextTextureWidget
TextTextureWidget is an advanced text widget compared with LabelWidget. It wrapper an internal TextTexture, therefore, you can set the all text rendering properties by it.
Basic Properties
| Field | Description |
|---|---|
| lastComponent | The last component text displayed read only |
| textTexture | Internal TextTexture read only |
APIs
textureStyle
Modifies the style of the internal text texture. see TextTexture for more details.
java
textTextureWidget.textureStyle(texture -> {
texture.setType(TextType.ROLL);
texture.setRollSpeed(0.5);
});javascript
textTextureWidget.textureStyle(texture => {
texture.setType(TextType.ROLL);
texture.setRollSpeed(0.5);
});setText
Sets the text using a string.
java
textTextureWidget.setText("Hello World");setText / setComponent
Sets the text using a Component.
java
textTextureWidget.setText(Component.literal("Hello World"));javascript
textTextureWidget.setComponent("....");setText / setTextProvider
Sets the text using a Supplier.
java
textTextureWidget.setText(() -> "dynamic text");javascript
textTextureWidget.setTextProvider(() => Component.string("dynamic text"));