How can I turn off the blinking cursor in a TextAr

2019-08-20 04:16发布

问题:

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?

回答1:

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 ;
}