JavaFX / ScalaFX - Change text color of disabled TextArea?
I have a GUI with some TextArea controls to display information. Since the GUI will respond to key events, I added an EventHandler to the scene element. Since I didn't want to add one EventHandler to each text area, I disabled them to prevent them from focusing, because then the scene's event handler no longer works. Now I have the problem that the text is grayed out and not black, but I changed it in the css file. Do you have any ideas why the text is not black and how can I fix it?
Here's some code:
private val scene =
new Scene {
stylesheets.add("css/style.css")
onKeyTyped = (new EventHandler[KeyEvent] {
def handle(event: KeyEvent) {
...
}
})
...
}
private val description = new TextArea{
text = "some text"
wrapText = true
disable = true
styleClass.add("txtarea")
maxHeight = 400
}
.txtarea:disabled{
-fx-font-size: 18pt;
-fx-text-fill: #000000;
-fx-prompt-text-fill: #000000;
-fx-opacity: 1.0;
-fx-background-color: white;
}
+3
source to share