How to change the color of text in javafx TextField? -
i want change font color in textfield .i found -fx-background-color , -fx-border-color changing color of background , border nothing text . ideas? in advamce
the css styles text input controls such textfield javafx 8 defined in modena.css stylesheet below. create custom css stylesheet , modify colors wish. use css reference guide if need understanding syntax , available attributes , values.
.text-input { -fx-text-fill: -fx-text-inner-color; -fx-highlight-fill: derive(-fx-control-inner-background,-20%); -fx-highlight-text-fill: -fx-text-inner-color; -fx-prompt-text-fill: derive(-fx-control-inner-background,-30%); -fx-background-color: linear-gradient(to bottom, derive(-fx-text-box-border, -10%), -fx-text-box-border), linear-gradient(from 0px 0px 0px 5px, derive(-fx-control-inner-background, -9%), -fx-control-inner-background); -fx-background-insets: 0, 1; -fx-background-radius: 3, 2; -fx-cursor: text; -fx-padding: 0.333333em 0.583em 0.333333em 0.583em; /* 4 7 4 7 */ } .text-input:focused { -fx-highlight-fill: -fx-accent; -fx-highlight-text-fill: white; -fx-background-color: -fx-focus-color, -fx-control-inner-background, -fx-faint-focus-color, linear-gradient(from 0px 0px 0px 5px, derive(-fx-control-inner-background, -9%), -fx-control-inner-background); -fx-background-insets: -0.2, 1, -1.4, 3; -fx-background-radius: 3, 2, 4, 0; -fx-prompt-text-fill: transparent; } although using external stylesheet preferred way styling, can style inline, using below:
textfield.setstyle("-fx-text-inner-color: red;");
Comments
Post a Comment