从JavaFX输入字段中删除蓝框 [英] Remove blue frame from JavaFX input field

查看:113
本文介绍了从JavaFX输入字段中删除蓝框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法从输入字段中删除蓝框?

Is there a way to remove the blue frame from input filed?

推荐答案

您正在显示的蓝色边框是焦点边框。

The blue border you are showing is the focus border.

要完全删除它,请使用类似

To remove it entirely, use something like

textField.setStyle("-fx-focus-color: -fx-control-inner-background ; -fx-faint-focus-color: -fx-control-inner-background ;");

或外部css文件

.text-field {
        -fx-focus-color: -fx-control-inner-background ;
    -fx-faint-focus-color: -fx-control-inner-background ;
}

要使其与未聚焦的文本字段相同,请使用

To make it the same as the unfocused text field, use

.text-field:focused {
    -fx-background-color: linear-gradient(to bottom, derive(-fx-text-box-border, -10%), -fx-text-box-border),
        linear-gradient(from 0px 0px to 0px 5px, derive(-fx-control-inner-background, -9%), -fx-control-inner-background);
}

这篇关于从JavaFX输入字段中删除蓝框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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