How to change the color of pane in javafx?
问题 I want to change the color of a Pane which I get as a String from user. How can I set this String as a background color in my pane? Code: colorField.setOnKeyTyped(new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent t) { color = colorField.getText(); } }); 回答1: If you really just want to know how to accomplish that particular thing, I'd suggest the following: Set the Nodes' CSS like this, using the hexacolor that was entered by the user: String enteredByUser = "abcdef";