6

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

enter image description here

user1285928
  • 1,328
  • 29
  • 98
  • 147
  • possible duplicate of [How do I remove the default border glow of a JavaFX button (when selected)?](http://stackoverflow.com/questions/6092500/how-do-i-remove-the-default-border-glow-of-a-javafx-button-when-selected) – jewelsea Apr 29 '14 at 20:38

1 Answers1

13

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);
}
James_D
  • 201,275
  • 16
  • 291
  • 322