• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

JavaFx 8 and scenebuilder Help - CSS error parsing in-line style: -fx-background-image

Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm having a frustrating time trying to set my background image in my css file using scenebuilder and JavaFx. I put the file in my projects folder (my view package ) and I even set my id and Style in the right hand side of my scenebuuilder window. I still cant get the image to appear. I can get a color to appear and everything else but I cant get that image.my id

Is set as AnchorPane so I used this in my style sheet:

Then I did this in my Main Class and method:


and after all this I get No image. I just wan't to know what I'm doing wrong for something soooo simple?

I've added several screen shots just to give you an idea...

[Thumbnail for projectsScreenShot.png]
Project tree with css and image location inside packages
[Thumbnail for sceenBuilderscreenshot.png]
scenebuuilder with css added in the properties window on the right
[Thumbnail for cssscreenshot.png]
my css code
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you specify a url within a css file then the url will be relative to where the referencing css file is. In your case, from your screen captures, your table.JPG file is in the same directory as your css file in which case try this:

Also watch out for case sensitivity, on some platforms it matters, eg "jpg" versus "JPG".
We don't have time to be charming! Quick, read this tiny ad:
the value of filler advertising in 2021
    Bookmark Topic Watch Topic
  • New Topic