How can I turn off the blinking cursor in a TextArea in Java?
Asked Answered
P

1

0

In Perl Tk the trick is that you can set the 'insert on time' of a text widget to 0, which has the effect of turning off the blinking cursor:

$self->{status_line}=$self->{status_frame}->Text(
-width=>80,-font=>[-size=>10],-height=>1,
-insertontime=>0)->pack(-side=>'left');

Is there an equivalent of this in Java to turn off the blinking cursor?

Puerile answered 2/6, 2015 at 13:13 Comment(1)
This is pretty much a duplicate of Hide input caret of TextField in JavaFX8, but I won't make it as a duplicate as James' answer is better than any current answers in the original question.Afore
B
2

You can do this in CSS with

-fx-display-caret: false ;

either inline:

textArea.setStyle("-fx-display-caret: false;");

or in an external CSS file:

.text-area {
    -fx-display-caret: false ;
}
Bewilderment answered 2/6, 2015 at 13:23 Comment(1)
Not really: I just read the docs ;) Mark the answer as correct, though, if it does what you need. That way it will be easier for other users to find it.Bewilderment

© 2022 - 2024 — McMap. All rights reserved.