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!

How to set background image for GridPane?

928280Apr 9 2012 — edited Apr 10 2012
Hi,everyone:

I wonder how to set the background image for GridPane using CSS? My code isn't working well, the background image is not showing as I expected. Since I am quite new to this JavaFX, can any kind person give me a hint?

GridPane grid = new GridPane();
grid.setStyle("-fx-background-image: url('images/background.png');-fx-background-size: stretch;-fx-background-position:center top;");

Really appreciate!!

Hebe
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 8 2012
Added on Apr 9 2012
2 comments
755 views