0

I want to change the background color of the TextArea to the current color selected in ColorPicker. The problem is, TextArea has some depth and I can't directly change the background color of it through normal code.

How would I go about binding the background color of the textarea to the current color in colorpicker?

P.S. I know how to 'manually' change the background color of a TextArea through CSS. I want to do it through normal code. Here is how it works in CSS;

.text-area .content {
    -fx-background-color: red;
}
  • Have you tried using setStyle? – SedJ601 May 04 '17 at 20:16
  • Doesn't work with TextArea because you can't directly change the background color of a text area. You have to change the background color of the content of textarea, which is not accessible through textarea.getContent() since that method does not exist. –  May 04 '17 at 20:18
  • How did you change it in css? – SedJ601 May 04 '17 at 20:19
  • I edited the thread accordingly. –  May 04 '17 at 20:20
  • I am guessing it's similar to changing the color of a textfield. http://stackoverflow.com/questions/27700006/how-do-you-change-the-background-color-of-a-textfield-without-changing-the-borde – SedJ601 May 04 '17 at 20:20
  • Here for textarea: http://stackoverflow.com/questions/31823715/how-to-change-textarea-background-color-more-than-once – SedJ601 May 04 '17 at 20:21
  • The one for textfield works splendidly! Thanks, you can turn that comment into an answer now ^^ –  May 04 '17 at 20:28

0 Answers0