How to create JavaFX TextField look like Android TextField using JavaFX CSS ?
For example :
I have tried lots of FX css but not achieved look like that . Here http://jsfiddle.net/QKm37/ CSS exist for HTML input type but it is not applicable in JavaFX SceneBuilder .
For example : /** Not Exist in JavaFX **/
-fx-border: none;
-fx-background: bottom left linear-gradient(#a9a9a9, #a9a9a9) no-repeat, bottom center linear-gradient(#a9a9a9, #a9a9a9) repeat-x, bottom right linear-gradient(#a9a9a9, #a9a9a9) no-repeat;
The default css is always applied to every JavaFX application. However, you can create one or more custom stylesheets of your own and add them to your application to override the default styles defined by JavaFX.
TextField class is a part of JavaFX package. It is a component that allows the user to enter a line of unformatted text, it does not allow multi-line input it only allows the user to enter a single line of text. The text can then be used as per requirement.
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()
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;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With