Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set the background color of a ScrollPane in JavaFX 8

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)?

like image 828
GowthamIyer Avatar asked Dec 10 '13 06:12

GowthamIyer


People also ask

How do you change the color of the background in JavaFX?

The simplest way to set the JavaFX Scene background color or image is by invoking the Scene 's setFill() method, which can accept a color, gradient or image pattern. A more flexible way to set the background of a scene is to set the root node's background, which can accept multiple images and fills.

What is Javapx ScrollPane?

The ScrollPane allows the application to set the current, minimum, and maximum values for positioning the contents in the horizontal and vertical directions. These values are mapped proportionally onto the layoutBounds of the contained node.

How do you make the scroll pane transparent?

Set an id to your AnchorPane in the fxml and then in your css assign the id to -fx-background-color : transparent.


1 Answers

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.

like image 116
GowthamIyer Avatar answered Sep 19 '22 11:09

GowthamIyer