Unfortunately, there's no CSS property that handles text transformation in JavaFX (currently none, see the JavaFX CSS Reference). But you can actually do it in Java with just a single line of code!
For an instance, you have a Label
node which has an ID named label
.
<Label fx:id="label" text="Hello!" />
In this case, you can reference the node
by its ID and set its text toUpperCase()
with a controller class.
// Reference to the node you wish
// to transform texts to uppercase.
@FXML private Label label;
@Override
// Assuming you have Initializable class implemented.
public void initialize(URL arg0, ResourceBundle arg1) {
// Get the current text value of the node.
String text = label.getText();
// Then update the text into whatever case you like.
label.setText(text.toUpperCase());
}
OR
Simply straight from a Java code (one straight line of code).
Label label = new Label("Hello!".toUpperCase());