如何在Java中的TextArea中关闭闪烁的光标? [英] How can I turn off the blinking cursor in a TextArea in Java?

查看:291
本文介绍了如何在Java中的TextArea中关闭闪烁的光标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Perl Tk中,技巧是你可以将文本小部件的插入时间设置为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');

在Java中是否有相当于这个以关闭闪烁光标的内容?

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

推荐答案

您可以在CSS中执行此操作

You can do this in CSS with

-fx-display-caret: false ;

内联:

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

或在外部CSS文件中:

or in an external CSS file:

.text-area {
    -fx-display-caret: false ;
}

这篇关于如何在Java中的TextArea中关闭闪烁的光标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆