JavaFX TextField CSS

Try this in your CSS file:

.text-field {
    -fx-background-color: #a9a9a9 , white , white;
    -fx-background-insets: 0 -1 -1 -1, 0 0 0 0, 0 -1 3 -1;
}

.text-field:focused {
    -fx-background-color: #a9a9a9 , white , white;
    -fx-background-insets: 0 -1 -1 -1, 0 0 0 0, 0 -1 3 -1;
}

There is a library for material components called jfoenix, it basically give javafx components a material style. java material library after adding the library just instantiate a JFXTextField() example of android styled textfield