7

I cannot set the background color of a ScrollPane in the latest version of JavaFX 8 (java 8 b-110 and above versions). So I need to know whether this is a permanent issue or temporarily (which can be Fixed in later versions)?

Jon Onstott
  • 13,499
  • 16
  • 80
  • 133
GowthamIyer
  • 485
  • 1
  • 5
  • 17
  • 1
    possible duplicate of [ScrollPanes in JavaFX 8 always have gray background](http://stackoverflow.com/questions/22952531/scrollpanes-in-javafx-8-always-have-gray-background) – jewelsea Apr 09 '14 at 17:43

3 Answers3

10

I ended up using -fx-background:green; instead of -fx-background-color:green; because -fx-background-color only set the colour for the borders of ScrollPane.

tvkanters
  • 3,519
  • 4
  • 29
  • 45
GowthamIyer
  • 485
  • 1
  • 5
  • 17
2

It looks like some additional CSS is needed in order to be able to set ScrollPane backgrounds to whatever color you like. See this question:

ScrollPanes in JavaFX 8 always have gray background

Community
  • 1
  • 1
Jon Onstott
  • 13,499
  • 16
  • 80
  • 133
  • that too an option we can set styles instead of calling a class we can use the code like scrollPane.setStyle("-fx-background-color:green;"); – GowthamIyer Apr 25 '14 at 08:12
0

May be This Can Help..

JavaFX ScrollPane border and background

..

JavaFX Hide ScrollPane gray border

....

JavaFX ScrollPane showing objects outside of viewport

....

JAVAFX 2.0 How can i dynamically change the content in a scrollPane?

Community
  • 1
  • 1
Imran Ali Khan
  • 8,469
  • 16
  • 52
  • 77
  • I understand your comment but use that comment in the java version java 8 b 110 and more version as we know latest java version is java 8 b 120... please kindly put this code in your system after installing the java version which i recommends to u.. i Hope u will understand my question buddy..... ScrollPane sp = new ScrollPane(); sp.setStyle("-fx-background-color:green;"); – GowthamIyer Dec 18 '13 at 11:49