JavaFX how to show read-only text?


Question

I want to show some text in my program and I tried with TextArea. However, the text shown is changeable. How can I make the text read only?

1
10
4/10/2019 5:18:39 AM

Accepted Answer

Maybe just a text would serve the purpose.

Or if you want to show the text in a text field, then:

tf.setDisable(true)
14
7/27/2017 5:52:25 PM

I did it like this:

@FXML
private TextArea myText;

and then added the following code to initialise():

myText.setEditable(false);

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon