Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Make TextArea background gradient fixed

cshSep 27 2014 — edited Oct 3 2014

Hi,

I have a TextArea and want to set a linear-gradient as background, which works fine:

.text-area {

    -fx-background-color: linear-gradient(to bottom, red 0%, blue 100%);

}

The problem is that if the TextArea contains much text (and long scrollbars) it is nearly only red. Only if you scroll down to the bottom, it becomes blue.

I want the red-blue gradient always look the same, no matter how much text there is.

In HTML there's something like background-attachment: fixed, which would do the trick, but not so in JavaFX.

Can I achieve it nonetheless. Preferably without any ugly workarounds, like a transparent TextArea within another Pane where the wrapping Pane has the gradient.

Thanks!

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 31 2014
Added on Sep 27 2014
2 comments
1,378 views