Skip to content

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 ​

FieldDescription
lastComponentThe last component text displayed read only
textTextureInternal 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);
});

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"));

setText / setTextProvider ​

Sets the text using a Supplier.

java
textTextureWidget.setText(() -> "dynamic text");

Released under the MIT License.