To change the use of opacity:
.text-input:disabled { -fx-opacity: 1.0; }
in the css file.
To change the color text used (after I read the question correctly, I know they didn't ask this.)
From the modena.css stylesheet:
.root { -fx-control-inner-background: derive(-fx-base,80%); -fx-control-inner-background-alt: derive(-fx-control-inner-background,-2%); }
.root { -fx-text-inner-color: #FF01F3; }
For instance:
@Override public void start(Stage primaryStage) { VBox root = new VBox(); root.setAlignment(Pos.CENTER); Button btn = new Button(); TextField text= new TextField(); btn.setText("Press me!"); btn.setOnAction((ActionEvent event) -> { text.setText("Goodbye World"); }); root.getChildren().addAll(btn, text); Scene scene = new Scene(root, 300, 250); scene.getStylesheets().addAll(getClass().getResource("css.css").toExternalForm()); primaryStage.setScene(scene); primaryStage.show(); }
And the color of the text in the text box will be pink? purple?
This is not a way to change the color for each text field separately, if you change it for the root, then all text fields will use this color instead of the usual black. I do not know how to change the color for one text field to blue, and for another in the same application - red.
source share