Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Adding CSS produces error

 
kevin flint
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm new to JavaFX.

I just started doing this.


^ How I arranged my files.

Here's the code:



I don't know where I went wrong, but here's the error.


My CSS code:



Where did I go wrong?
 
Darryl Burke
Bartender
Posts: 5149
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
getStylesheets().add(...) needs the path to the resource, not the external form of the URL -- which starts with a protocol.

See Skinning JavaFX Applications with CSS for an example.
 
kevin flint
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried doing it like this


I saved the main file and the css file in the same package.

Got this new error.
 
kevin flint
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got it working now. I just rebuilt the project. Weird.
 
Darryl Burke
Bartender
Posts: 5149
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nothing weird about it. Rebuilding a NetBeans project copies resources to the build/classes folder. Keep that in mind whenever you use any kind of resources.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic