Remove blue frame from JavaFX input field

老子叫甜甜 提交于 2020-01-12 07:48:06

问题


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


回答1:


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 ;");

or in an external css file

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


来源:https://stackoverflow.com/questions/23374244/remove-blue-frame-from-javafx-input-field

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!