Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Jaytee Simon
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • 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:



FXML



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...

projectsScreenShot.png
[Thumbnail for projectsScreenShot.png]
Project tree with css and image location inside packages
sceenBuilderscreenshot.png
[Thumbnail for sceenBuilderscreenshot.png]
scenebuuilder with css added in the properties window on the right
cssscreenshot.png
[Thumbnail for cssscreenshot.png]
my css code
 
Steffe Wilson
Ranch Hand
Posts: 165
12
  • Mark post as helpful
  • send pies
  • 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".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic