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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

CSS styling of ScrollPanes broken in JavaFX 8?

ibibbyMar 24 2014 — edited Mar 26 2014

In my application, I have a ScrollPane. The CSS file sets the ScrollPane's background to a dark gray using the -fx-background-color setting... or at least it did. After moving to JavaFX 8, I've noticed that setting -fx-background-color on a ScrollPane now only sets the color of the thin lining around the scrollbars. The background of the ScrollPane remains a light grey color. In fact, I can't find a way to set the background color of a ScrollPane AT ALL anymore! Is this a bug, or is there a new way to do it that I'm missing?

This post has been answered by David Grieve-Oracle on Mar 24 2014
Jump to Answer

Comments

David Grieve-Oracle
Answer

.scroll-pane > .viewport  { -fx-background-color: red; }

Marked as Answer by ibibby · Sep 27 2020
ibibby

Thanks, David, .viewport did the trick!

Btw, is this documented anywhere? The only CSS reference I could find for JavaFX 8 is this one, and it doesn't mention the .viewport style class.

bouye-JavaNet

While playing with the betas I often ended up resorting to use Jonathan Giles' ScenicView scenegraph explorer tool so I would find out how some control's skin had been modified in JDK 8 and adapt my CSS from JavaFX 2.x accordingly to have a proper appearance.

David Grieve-Oracle

Thanks for pointing that out. I created https://javafx-jira.kenai.com/browse/RT-36393 for the issue.

1 - 4
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Apr 23 2014
Added on Mar 24 2014
4 comments
12,625 views